parser library

A Flutter-free, incremental Markdown parser designed for LLM output that arrives in small chunks.

Import this library to use the parser from plain Dart (CLIs, servers, isolates). Flutter apps normally import llm_markdown_renderer.dart, which re-exports everything here.

Classes

Block
A block-level Markdown node.
BlockQuoteBlock
A block quote: > text.
CodeBlock
A fenced (```) or indented code block.
CodeHighlighter
Turns lines of source code into syntax Tokens.
HeadingBlock
An ATX (# Title) or setext heading.
IncrementalMarkdownParser
Parses Markdown incrementally, as it is streamed in chunks.
Inline
A node of inline Markdown content (text, emphasis, links, …).
InlineCode
An inline code span: `code`.
InlineEmphasis
Emphasized (usually italic) content: *text* or _text_.
InlineImage
An image: ![alt](url "title").
InlineLineBreak
A hard line break (two trailing spaces or a trailing backslash).
A hyperlink: [label](url "title"), <url> or a bare https:// URL.
InlineSoftBreak
A soft line break: a single newline inside a paragraph.
InlineStrikethrough
Struck-through content: ~~text~~.
InlineStrong
Strongly emphasized (usually bold) content: **text**.
InlineText
A run of literal text.
LanguageDefinition
A language described as a set of named lexer states.
LexRule
One lexing rule: when pattern matches at the current position, the match becomes a token of kind and lexing continues in state next (or stays in the current state when null).
LineHighlight
The result of highlighting one line.
ListBlock
An ordered or unordered list.
ListItem
One item of a ListBlock.
MarkdownDocument
An immutable snapshot of a parsed (possibly still streaming) document.
MarkdownParserOptions
Feature switches for the Markdown parser.
ParagraphBlock
A paragraph of inline content.
RuleBasedHighlighter
A CodeHighlighter driven by small regular-expression lexers.
TableBlock
A GitHub-flavoured Markdown table.
ThematicBreakBlock
A thematic break: ---, *** or ___.
Token
A highlighted slice [start, end) of a single line.

Enums

TableAlignment
Horizontal alignment of a table column.
TokenKind
The syntactic category of a Token, used to pick a colour from the theme.