markdown_core library
Parser, document, source selection, and copy contracts without Flutter types.
Use MarkdownParser for complete grammar replacement or DefaultMarkdownParser with syntax rules for extensions. Snapshots retain UTF-16 source ranges and stable node identities; SourceOffsetIndex converts to and from backend UTF-8 offsets. Selection and serialization can operate without mounted widgets or an animation clock.
Flutter renderer, animator, and clipboard platform integrations are exported
by animated_streaming_markdown.dart instead.
Classes
- CopyStrategy
- Serialization extension point independent of rendering and animation.
- DefaultMarkdownParser
- Built-in block grammar plus semantic inline parsing and ordered extensions.
- DefaultMarkdownParserSession
- The default synchronous session with retained source and reconciled IDs.
- DocumentChangeSet
- Identity changes between immutable document revisions.
- ExactSourceCopyStrategy
- Exact source slicing; intentionally distinct from legacy raw serialization.
- ImageClipboardCopyStrategy
- Resolves optional image bytes without imposing platform transport on core.
- ImageSourceCopyStrategy
- Uses image source URLs where available, with semantic text as fallback.
- LegacyMarkdownDocumentAdapter
- Adapts caller-created legacy blocks using built-in semantic extraction.
- LegacyRawCopyStrategy
- Compatibility formatting for the historical SelectionStrategy.raw mode.
- MarkdownClipboardBinary
- Encoded clipboard data with a MIME type and defensively copied bytes.
- MarkdownClipboardCapabilities
- Platform adapters advertise support; the semantic core never invokes them.
- MarkdownCopyContent
- Optional representations of the selected slice supplied by a renderer.
- MarkdownCopyContext
- A selected fragment slice and its immutable document revision.
- MarkdownCopyPayload
- Serialized content captured from a single document revision.
- MarkdownCopyRequest
- Captures the semantic document and source-based selection before async I/O.
- MarkdownCopyService
- Serializes a captured request and then hands its payload to a writer.
- MarkdownCopyStrategy
- Serializes selected semantic structures as Markdown.
- MarkdownCopyWriter
- Optional transport boundary for text, HTML and supported encoded images.
- MarkdownDocumentReconciler
- Source-based identity reconciliation for full-source custom parsers. Parsers with stronger grammar identity may construct changes themselves.
- MarkdownDocumentSelection
- Directional UTF-16 source offsets belonging to a document snapshot.
- MarkdownDocumentSelectionState
- Selection bookkeeping independent of Flutter and animation lifetimes.
- MarkdownDocumentSnapshot
- An immutable, source-backed semantic document shared by all presentation.
- MarkdownImageAsset
- A document-level reference; it does not own a mounted Image or ui.Image.
- MarkdownImageAssetResolver
- Resolves encoded image bytes on demand, without a mounted image widget.
- MarkdownInputArrival
- One input arrival in source coordinates, independent of model tokenization.
- MarkdownNode
- A semantic node. Custom parsers may use any kind and payload.
- MarkdownParser
- Factory for independent, source-backed parsing sessions.
- MarkdownParserSession
- Mutable parser state publishing immutable semantic snapshots.
- MarkdownSelectionAnchor
- An endpoint that can be resolved after its presentation child is disposed.
- MarkdownSemanticDocument
- Complete logical content, including fragments whose widgets are offscreen.
- MarkdownSemanticFragment
- One selectable fragment declared before its widget is materialized.
- MarkdownSourceRange
- A half-open range in UTF-16 code units of a document's source.
- MarkdownSyntaxMatch
- Returning a match claims range; built-in syntax cannot reinterpret it.
- MarkdownSyntaxRequest
- Context passed at a UTF-16 source boundary to a syntax extension.
- MarkdownSyntaxRule
- A synchronous extension to the default parser's block or inline grammar.
- PlainTextCopyStrategy
- Copies declared semantic text, including declared structural separators.
- RichTextCopyStrategy
- Serializes semantic HTML with a plain-text fallback, without reparsing.
- SourceOffsetIndex
- Converts offsets between Dart strings and the UTF-8 source used by parsers.
Enums
- MarkdownCopyFormat
- Serialization requested from a fragment copy provider.
- MarkdownImageAssetKind
- Origin of an image reference; resolving bytes is an optional separate step.
- MarkdownParserBackend
- Backend preference for DefaultMarkdownParser.
- MarkdownSyntaxContext
- The built-in semantic extraction boundary at which a rule is evaluated.
- MarkdownSyntaxMatchStatus
- Whether a rule declines the input or claims complete/incomplete syntax.
Typedefs
-
MarkdownCopyProvider
= FutureOr<
MarkdownCopyContent?> Function(MarkdownCopyContext context) - Optional renderer semantics, evaluated against the captured copy snapshot.