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.
Properties
Section titled “Properties”
readonlyunit:SourceUnit
Defined in: parse/registry.ts:55
Source unit being parsed
Methods
Section titled “Methods”createSourcePos()
Section titled “createSourcePos()”createSourcePos(
node):SourcePos|undefined
Defined in: parse/registry.ts:58
Create source position from node
Parameters
Section titled “Parameters”Returns
Section titled “Returns”SourcePos | undefined
emitDiagnostic()
Section titled “emitDiagnostic()”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.
Parameters
Section titled “Parameters”diagnostic
Section titled “diagnostic”Omit<ParseDiagnostic, "file">
Returns
Section titled “Returns”void
getAttr()
Section titled “getAttr()”getAttr(
element,name):string|undefined
Defined in: parse/registry.ts:76
Get attribute value (HTML)
Parameters
Section titled “Parameters”element
Section titled “element”Element
string
Returns
Section titled “Returns”string | undefined
getTextContent()
Section titled “getTextContent()”getTextContent(
element):string
Defined in: parse/registry.ts:73
Get text content of element (HTML)
Parameters
Section titled “Parameters”element
Section titled “element”Element
Returns
Section titled “Returns”string
transformBlockChildren()
Section titled “transformBlockChildren()”Defined in: parse/registry.ts:64
Transform children to block nodes (recursive)
Parameters
Section titled “Parameters”children
Section titled “children”RootContent[] | RootContent[]
Returns
Section titled “Returns”transformInlineChildren()
Section titled “transformInlineChildren()”transformInlineChildren(
children):Inline[]
Defined in: parse/registry.ts:61
Transform children to inline nodes
Parameters
Section titled “Parameters”children
Section titled “children”RootContent[] | RootContent[]
Returns
Section titled “Returns”Inline[]