parse static method
MdDocument
parse(
- String markdown, {
- bool useDollarSignsForLatex = false,
- MarkdownBlockRegistry? blockRegistry,
- MarkdownDefinitions? definitions,
- MarkdownHtml? html,
Parses markdown into a structured MdDocument tree.
Synchronous and fast — suitable for re-parsing streaming LLM output.
Set useDollarSignsForLatex to also treat $ … $ / $$ … $$ as LaTeX
in addition to the always-on \( … \) / \[ … \] forms (mirrors
gpt_markdown's option).
Link reference and footnote definitions are collected from markdown
itself. When parsing a document in pieces, collect them once from the
whole of it with MarkdownDefinitions.collect and pass them as
definitions, so a reference in one piece finds a definition in another.
html decides which HTML tags are understood and what each becomes;
MarkdownHtml.defaults when null, and MarkdownHtml.none for no HTML
at all.
Implementation
static MdDocument parse(
String markdown, {
bool useDollarSignsForLatex = false,
MarkdownBlockRegistry? blockRegistry,
MarkdownDefinitions? definitions,
MarkdownHtml? html,
}) {
return parseDocument(
markdown,
useDollarSignsForLatex,
blockRegistry,
definitions,
html,
);
}