Three Diagram Engines
Supports Mermaid, Excalidraw, and Draw.io files out of the box. Extension aliases like .mmd, .mmdc, .dio, and .drawio.xml are recognized automatically.
Render .mermaid, .excalidraw, and .drawio files to SVG/PNG/JPEG/WebP with automatic light and dark theme variants.
# Install
npm add diagramkit
# Install the browser engine once per environment
npx diagramkit warmup
# Optional: required for PNG, JPEG, and WebP output
npm add sharp
# Render all diagrams in the current directory
npx diagramkit render .Output goes to a .diagrams/ folder next to each source file:
docs/
architecture.mermaid
.diagrams/
architecture-light.svg
architecture-dark.svg
diagrams.manifest.jsonUse a <picture> element for automatic light/dark switching in HTML:
<picture>
<source srcset=".diagrams/architecture-dark.svg" media="(prefers-color-scheme: dark)">
<img src=".diagrams/architecture-light.svg" alt="Architecture diagram">
</picture>