mermaid-cli converts .mmd files and Markdown code fences into SVG, PNG, or PDF. Docker, npx, and Node installs run the mmdc tool for batch and stdin pipelines.
Overview
The mermaid-cli package wraps the Mermaid diagram library for shell and automation use. Given a Mermaid definition file, mmdc renders vector or raster output and can rewrite Markdown documents so fenced mermaid blocks become linked SVG assets.
Options cover themes, transparent backgrounds, custom icon packs, CSS animation injection, size limits for PNG exports, and piping diagrams from stdin. Docker and Podman images mount host /data or custom workdirs for isolated runs.
Local npm install avoids some global install issues; npx -p @mermaid-js/mermaid-cli mmdc is documented. A Node API exists but follows Mermaid versioning rather than semver for the CLI wrapper.
Known issues cover Linux sandbox behavior, Docker permissions, and bundling custom Chromium builds for headless rendering.
Key features
- SVG PNG PDF export
- Markdown diagram extraction
- Stdin and heredoc input
- Docker and Podman images
- Custom CSS and icon packs
- Theme and background controls
- Node.js programmatic API
Use cases
- CI diagram rendering
- Docs pipelines with Mermaid
- Batch chart generation