The render package is engine-agnostic. It ships with built-in engines, and you can register custom engines at runtime.
Uses the mermaid package in-process with a jsdom DOM shim. This provides deterministic rendering without spawning external processes.
Optional dependencies:
mermaidjsdomdompurify(sanitizer)
Current pinned version:
mermaid@10.9.5
Uses the Mermaid CLI (@mermaid-js/mermaid-cli) via subprocess. This is useful if you already use mmdc in CI.
Set MERMKIT_MMDC_PATH to point to a custom binary.
Produces a placeholder SVG with the Mermaid source as text. Useful for early integration.
A pure-TypeScript ASCII/Unicode renderer. Supports flowcharts (LR and TD directions) and sequence diagrams. Outputs box-drawing characters by default; pass --ascii on the CLI for plain ASCII (+, -, |) mode.
This engine is skipped in auto mode. Request it explicitly:
- CLI:
--engine asciior--format ascii - API:
{ engine: "ascii" }or{ format: "ascii" }
Register your own engine:
import { registerEngine, render } from "@mermkit/render";
registerEngine({
id: "beautiful-mermaid",
priority: 40,
render: async (diagram, options) => {
// return { bytes, mime, warnings }
}
});
await render(diagram, { format: "svg", engine: "beautiful-mermaid" });engine: "auto" will try engines in priority order (highest first).