Ga naar hoofdinhoud

Class: MarkdownReader

Extract text from markdown files. Returns dictionary with keys as headers and values as the text between headers.

Implements

Constructors

constructor

new MarkdownReader(removeHyperlinks?, removeImages?): MarkdownReader

Parameters

NameTypeDefault valueDescription
removeHyperlinks?booleantrueIndicates whether hyperlinks should be removed.
removeImages?booleantrueIndicates whether images should be removed.

Returns

MarkdownReader

Defined in

packages/core/src/readers/MarkdownReader.ts:20

Properties

Private _removeHyperlinks: boolean

Defined in

packages/core/src/readers/MarkdownReader.ts:13


_removeImages

Private _removeImages: boolean

Defined in

packages/core/src/readers/MarkdownReader.ts:14

Methods

loadData

loadData(file, fs?): Promise<Document<Metadata>[]>

Parameters

NameTypeDefault value
filestringundefined
fsGenericFileSystemdefaultFS

Returns

Promise<Document<Metadata>[]>

Implementation of

FileReader.loadData

Defined in

packages/core/src/readers/MarkdownReader.ts:91


markdownToTups

markdownToTups(markdownText): MarkdownTuple[]

Convert a markdown file to a dictionary. The keys are the headers and the values are the text under each header.

Parameters

NameTypeDescription
markdownTextstringThe markdown text to convert.

Returns

MarkdownTuple[]

  • An array of tuples, where each tuple contains a header (or null) and its corresponding text.

Defined in

packages/core/src/readers/MarkdownReader.ts:31


parseTups

parseTups(content): MarkdownTuple[]

Parameters

NameType
contentstring

Returns

MarkdownTuple[]

Defined in

packages/core/src/readers/MarkdownReader.ts:80


removeHyperlinks(content): string

Parameters

NameType
contentstring

Returns

string

Defined in

packages/core/src/readers/MarkdownReader.ts:75


removeImages

removeImages(content): string

Parameters

NameType
contentstring

Returns

string

Defined in

packages/core/src/readers/MarkdownReader.ts:70