Skip to main content

Class: MarkdownReader

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

Implements

Constructors

new MarkdownReader()

new MarkdownReader(removeHyperlinks?, removeImages?): MarkdownReader

Parameters

removeHyperlinks?: boolean= true

Indicates whether hyperlinks should be removed.

removeImages?: boolean= true

Indicates whether images should be removed.

Returns

MarkdownReader

Source

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

Properties

private _removeHyperlinks: boolean

Source

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


_removeImages

private _removeImages: boolean

Source

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

Methods

loadData()

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

Parameters

file: string

fs: GenericFileSystem= defaultFS

Returns

Promise <Document <Metadata>[]>

Implementation of

FileReader . loadData

Source

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

markdownText: string

The markdown text to convert.

Returns

MarkdownTuple[]

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

Source

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


parseTups()

parseTups(content): MarkdownTuple[]

Parameters

content: string

Returns

MarkdownTuple[]

Source

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


removeHyperlinks(content): string

Parameters

content: string

Returns

string

Source

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


removeImages()

removeImages(content): string

Parameters

content: string

Returns

string

Source

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