parse static method

MdDocument parse(
  1. String markdown, {
  2. bool useDollarSignsForLatex = false,
  3. MarkdownBlockRegistry? blockRegistry,
  4. MarkdownDefinitions? definitions,
})

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.

Implementation

static MdDocument parse(
  String markdown, {
  bool useDollarSignsForLatex = false,
  MarkdownBlockRegistry? blockRegistry,
  MarkdownDefinitions? definitions,
}) {
  return parseDocument(
    markdown,
    useDollarSignsForLatex,
    blockRegistry,
    definitions,
  );
}