Przejdź do głównej zawartości

Class: MarkdownReader

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

Extends

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

Overrides

FileReader . constructor

Source

packages/llamaindex/src/readers/MarkdownReader.ts:18

Properties

private _removeHyperlinks: boolean

Source

packages/llamaindex/src/readers/MarkdownReader.ts:11


_removeImages

private _removeImages: boolean

Source

packages/llamaindex/src/readers/MarkdownReader.ts:12

Methods

loadData()

loadData(filePath): Promise <Document <Metadata>[]>

Parameters

filePath: string

Returns

Promise <Document <Metadata>[]>

Inherited from

FileReader . loadData

Source

packages/llamaindex/src/readers/type.ts:17


loadDataAsContent()

loadDataAsContent(fileContent): Promise <Document <Metadata>[]>

Parameters

fileContent: Buffer

Returns

Promise <Document <Metadata>[]>

Overrides

FileReader . loadDataAsContent

Source

packages/llamaindex/src/readers/MarkdownReader.ts:92


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/llamaindex/src/readers/MarkdownReader.ts:30


parseTups()

parseTups(content): MarkdownTuple[]

Parameters

content: string

Returns

MarkdownTuple[]

Source

packages/llamaindex/src/readers/MarkdownReader.ts:81


removeHyperlinks(content): string

Parameters

content: string

Returns

string

Source

packages/llamaindex/src/readers/MarkdownReader.ts:76


removeImages()

removeImages(content): string

Parameters

content: string

Returns

string

Source

packages/llamaindex/src/readers/MarkdownReader.ts:71


addMetaData()

static addMetaData(filePath): (doc, index) => void

Parameters

filePath: string

Returns

Function

Parameters

doc: Document <Metadata>

index: number

Returns

void

Inherited from

FileReader . addMetaData

Source

packages/llamaindex/src/readers/type.ts:24