lexer_md.ts

Hand-written Markdown lexer — the structural rethink: a line-oriented block scan (fences, headings, blockquotes, lists, horizontal rules) with an inline scan per block (bold/italic/strikethrough, inline code, links, entities, and raw markup constructs dispatched through lexer_markup).

Fenced code is one fenced_code container (code_fence delimiter lines with the punctuation alias + a lang_* container embedding the fence language). The rest: heading/blockquote/list containers with aliased punctuation, link > link_text_wrapper/url_wrapper, inline_code (alias code) with content, bold/italic/strikethrough, and markup's tag/comment/entity vocabulary for raw HTML.

Notable behavior: fence info words match exactly ( ``json ` embeds json, not javascript) and closing fences accept any length ≥ the opener; interior lines starting with backticks are fence *content*, not stray code_fence tokens; heading/blockquote/list interiors get the inline scan; list containers span their line rather than swallowing preceding newlines; horizontal rules (---/***/___) get an hr token (alias punctuation). Emphasis delimiters require non-space-adjacent interiors free of the delimiter (and word boundaries for _ forms) and are line-bounded — they do not span paragraphs.

Resilience: an unterminated fence extends to the end of the window.

view source

Declarations
#

lexer_md
#

lexer_md.ts view source

SyntaxLang import {lexer_md} from '@fuzdev/fuz_code/lexer_md.js';

The Markdown language registration for the lexer engine.

Depends on
#

Imported by
#