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.
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).
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.
MdHeading
MdHorizontalRule
MdImage
MdInlineCode
Backtick span (code), rendered as highlighted inline code.
MdInlineLatex
MdItalic
MdLineBreak
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

MdAlign
Column alignment for tables (from the :---: separator row).

Functions

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