Skip to content

ParseContext

Defined in: parse/registry.ts:53

Unified context provided to parser modules

This is the common interface for both HTML and Markdown parser modules. Some methods may be no-ops depending on the format.

readonly unit: SourceUnit

Defined in: parse/registry.ts:55

Source unit being parsed

createSourcePos(node): SourcePos | undefined

Defined in: parse/registry.ts:58

Create source position from node

NodeWithPosition

SourcePos | undefined


emitDiagnostic(diagnostic): void

Defined in: parse/registry.ts:70

Emit a diagnostic from the parser module. Use for warnings about invalid structure, unsupported elements, etc.

Omit<ParseDiagnostic, "file">

void


getAttr(element, name): string | undefined

Defined in: parse/registry.ts:76

Get attribute value (HTML)

Element

string

string | undefined


getTextContent(element): string

Defined in: parse/registry.ts:73

Get text content of element (HTML)

Element

string


transformBlockChildren(children): (Section | Block)[]

Defined in: parse/registry.ts:64

Transform children to block nodes (recursive)

RootContent[] | RootContent[]

(Section | Block)[]


transformInlineChildren(children): Inline[]

Defined in: parse/registry.ts:61

Transform children to inline nodes

RootContent[] | RootContent[]

Inline[]