Expand description
markdown-stream — an incremental, streaming CommonMark/GFM parser.
Pure std, no runtime dependencies. Feed bytes to a StreamParser with Parser::write and
consume the flat Event stream it emits; call Parser::flush at end of input. The event
stream is independent of how the input is chunked (split-equivalence) — this is what makes
the parser usable on a live token stream from an LLM.
The parser is append-only and chunk-safe; renderers (markdown-html, markdown-terminal)
consume the events and never re-parse Markdown.
Structs§
- Block
Data - Variant-specific payload for an
EnterBlockevent. Defaults are empty/zero for blocks that carry no extra data (paragraphs, blockquotes, …). - Inline
Style - Inline styling carried on a
Textevent. Multiple flags may apply at once (e.g. bold + italic).linkis set for text inside a link/image. - Link
- A link or image target carried on a styled
Textevent. - List
Data - List metadata carried on an
EnterBlock(List)event. - Span
- A byte range in the source, with the 1-based line/column of its start.
- Stream
Parser
Enums§
- Alignment
- Column alignment for GFM table columns.
- Block
Kind - The kind of block an
EnterBlock/ExitBlockevent refers to. - Event
- One parser event. The stream is a depth-first walk: every
EnterBlockis eventually balanced by anExitBlockof the same kind. - Inline
- The kind of inline span an
EnterInline/ExitInlineevent opens or closes.
Traits§
- Parser
- An incremental, chunk-safe Markdown parser.