plusparse/plusparse library

plusparse — a fast, hand-written Markdown + LaTeX parser, fully rewritten in pure Dart and built into gpt_markdown (originally a Rust flutter_rust_bridge plugin).

Single-pass, regex-free, and error-tolerant: it never throws on malformed or partial (streaming) input, which makes it suitable for re-parsing streaming LLM output on every token. No initialisation or native library loading is needed — parsing is synchronous pure Dart.

Usage:

final MdDocument doc = Plusparse.parse('# Hello **world**');

Classes

FencedBlockSyntax
A convenient opaque container such as :::warning ... :::. Its body is raw text, including blank lines. An unfinished block consumes the remaining input with MdCustomBlock.closed false. It does not nest the same fence.
MarkdownBlockMatch
A successful match consumes endLine exclusively. Parsers must be pure, deterministic, and accept incomplete input. A match may inspect only its consumed lines; otherwise independently cached blocks would be unsafe.
MarkdownBlockRegistry
Compiled first-character dispatch shared by segmentation and parsing. Invalid consumption is rejected rather than looping or dropping input.
MarkdownBlockSyntax
A locally parsable custom block. Register a matching renderer with MarkdownBlockComponent on GptMarkdown.blockComponents.
MarkdownDefinitions
The link and footnote definitions of one document.
MarkdownSegmentCache
Retains settled segment strings between appends. Only the previous tail and appended source are split again. Edits or CR normalization fall back to a full split. Callers still compare source prefixes; this is not O(1).
MdAlert
The alert a MdBlockQuote carries. Not an MdNode: it rides on the quote, so the node hierarchy — and every exhaustive switch over it — is unchanged.
MdBlockLatex
MdBlockQuote
MdBold
MdCheckbox
MdCodeBlock
MdCustomBlock
An extension's parsed payload. body remains raw unless the extension explicitly parses it; data should be immutable and independent of Flutter.
MdDocument
Root of a parsed document.
MdFootnote
One footnote definition, [^label]: text.
MdFootnoteDefinitions
A run of consecutive footnote definitions, rendered where they were written — in a model's reply, that is the end.
MdFootnoteReference
A footnote reference such as [^1] or [^note], resolved against the document's footnote definitions. An unresolved [^x] stays text.
MdHeading
MdHorizontalRule
MdImage
MdInlineCode
Backtick span (code), rendered as highlighted inline code.
MdInlineLatex
MdItalic
MdLineBreak
MdLinkDefinition
Where a link reference definition points.
MdListItem
One item of an ordered/unordered list. children holds the item's inline content followed by any nested block nodes (e.g. a nested list).
MdNode
A node in the Markdown tree.
MdOrderedList
MdParagraph
MdRadio
MdSourceTag
A citation marker such as [1].
MdStrike
MdTable
MdTableCell
One cell of a table row; holds inline content.
MdTableRow
One row of a table.
MdText
MdUnderline
MdUnorderedList
Plusparse
Public entry point for the plusparse Markdown parser.

Enums

MarkdownAlertType
The kind of an alert, from the marker on the first line of a quote:
MdAlign
Column alignment for tables (from the :---: separator row).

Functions

splitStreamSegments(String src, {MarkdownBlockRegistry? blockRegistry}) → List<String>