mermaid-formatter

JSON →
library 0.3.0 ·javascript
verified Jun 4, 2026

Zero-dependency formatter for Mermaid diagram syntax. Current version 0.3.0, targets Node >=18. Provides CLI tool (mermaidfmt), Prettier plugin, and programmatic API. Supports all major diagram types (sequence, flowchart, class, state, ER, gantt, etc.) and formats Mermaid code blocks inside Markdown files. Differentiators: lightweight with zero runtime dependencies, uses its own AST parser, normalizes arrow message spacing (A->>B:msg → A ->> B: msg), and integrates with Prettier for consistent formatting across projects. Release cadence is irregular.