Skip to main content

Module inline_html

Module inline_html 

Source
Expand description

Inline raw HTML recognizer per CommonMark §6.6 / Pandoc raw_html.

Matches a single HTML tag (open/close), comment, processing instruction, declaration, or CDATA section starting at byte 0 of text. Returns the length in bytes of the matched span, or None if the prefix doesn’t parse.

The recognizer is intentionally byte-level and conservative: when a span looks plausible but doesn’t fully close (e.g. unterminated comment or quoted attribute), it returns None so the dispatcher falls back to emitting plain text.

Backslash escapes and entity references inside the span are not decoded — callers are expected to emit the bytes verbatim into the CST, and the renderer must skip the standard text-token escaping for INLINE_HTML nodes.

Functions§

emit_inline_html
Emit a single INLINE_HTML node holding the verbatim span.
try_parse_inline_html
Try to match an inline raw HTML span starting at text[0]. Returns the length in bytes consumed, or None if no match.