loading code fetching the highlighted snippet
Pass the built-in MermaidRenderer through the renderers prop. Handles async rendering, loading + error states, and dark-mode reactivity with no custom logic on your end.
markedMermaid() registers an async walkTokens extension
that turns ```mermaid fences into renderable tokens.MermaidRenderer handles flowcharts, sequence diagrams, class diagrams,
state diagrams, gantt charts.Regular markdown works alongside diagrams: bold, italic, and inline code.
Wrap each diagram in extra chrome via {#snippet mermaid} — figure + caption, custom container, anything you want. Delegates the async rendering itself to MermaidRenderer.
{#snippet mermaid({ text })} lets the page own the chrome around each
diagram — figure + caption, custom container, anything.MermaidRenderer — you only
own the wrapper.markedMermaid() — extension parses the fences, snippet
shapes the output.Regular markdown works alongside diagrams: bold, italic, and inline code.