Skip to content

Rich Markdown

Code, math, and Mermaid diagrams in Markdown

Use fenced code, bounded KaTeX, and isolated Mermaid rendering with explicit fallbacks and print review.

MDLoom documentation9 min read

Fence code and declare a language

Fenced blocks keep Markdown punctuation literal. A language label enables deterministic syntax highlighting, but it does not execute the code and should never be treated as a sandbox.

```ts
const profile = 'github-extended-v1';
```

Math is a declared extension with resource limits

Math syntax is outside formal GFM. GitHub Extended uses KaTeX with trust disabled plus explicit expression, expansion, and size limits. Unsupported commands or oversized expressions should produce a visible warning instead of unbounded layout work.

Diagrams render in an isolated, bounded path

Mermaid source remains text. Browser preview loads the renderer only for a diagram, while canonical PDF uses a pinned no-network worker transform, application-owned SVG validation, complexity limits, and a raster surface after validation.

```mermaid
flowchart LR
  Draft --> Review --> Publish
```

Keep a readable fallback and inspect the canonical artifact

Explain the diagram in nearby prose, choose readable colors and labels, and inspect text size and cropping in the exact PDF artifact. DOCX, ODT, and EPUB are structural conversions and can simplify extensions; their returned report is part of review.

Put it into practice

Open a clean workspace for your next document.

Start anonymously, choose an explicit Markdown profile, and keep source, preview, and diagnostics together.

Open the editor  →