Mermaid CLI
$ mmdc Official Low RiskMermaid CLI (mmdc) compiles Mermaid diagram definitions (.mmd or embedded Markdown fences) into SVG, PNG, or PDF files via headless Chromium/Puppeteer. While essential for verifying Mermaid syntax and generating visual assets, Puppeteer/Chromium dependencies make container setup heavier.
brew install mermaid-cli mmdc renders local .mmd and .md diagrams directly to SVG/PNG files in the workspace without needing an external server.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Simple -i / -o CLI interface with non-zero exit codes on Mermaid syntax errors, though Puppeteer Chromium startup adds latency.
- Non-interactive
-i input.mmd -o output.svgexecution - Fails with non-zero exit code on invalid diagram syntax
Local offline rendering with no credentials, though headless Chromium sandboxing needs care on Linux containers.
- Zero cloud auth surface
- Runs headless Chromium via Puppeteer
Puppeteer/Chromium browser download and Linux shared-library deps frequently trip up minimal CI containers.
- Requires Chromium binary and OS graphics libraries
De-facto standard for rendering and syntax-checking Mermaid diagrams in docs pipelines.
- Supports
.mmdand automatic Markdown fence extraction
Official Mermaid organization tool (mermaid-js/mermaid-cli) under MIT.
- Official Mermaid GitHub organization
Clear README covering Docker, Puppeteer config, and CLI flags.
- GitHub README and
mmdc --help
Security, Auth & Guardrails
No credentials required; local CLI renderer.
Free open-source software (MIT).
# Mermaid CLI Agent Rules - Prefer `-o <file>.svg` for crisp vector output and syntax validation. - In Linux/Docker sandboxes, provide a `puppeteer-config.json` (`-p`) if `--no-sandbox` is required. - Avoid rendering untrusted external Markdown files without Puppeteer isolation.
Agent-Ready Command Recipes
Safe Read-Only Queries
mmdc --version
Verifies mmdc installation without launching headless Chromium.
Controlled Writes & Previews
mmdc -i diagram.mmd -o dist/diagram.svg
Validates Mermaid syntax and writes the rendered SVG vector diagram to dist/diagram.svg.
Strengths for Agents
- + Authoritative Mermaid syntax validator and SVG/PNG/PDF renderer.
- + Can extract and transform Mermaid fences directly inside Markdown files (
-i doc.md -o doc.out.md). - + Clean
-i/-o/-t(theme) CLI flags.
Caveats & Pitfalls
- ! Depends on headless Chromium via Puppeteer, making installs heavy and prone to sandbox issues in Docker/Linux.
- ! Slower per-invocation startup than pure native diagram compilers like
d2ordot.