beautiful-mermaid v1.0.0
Layout Engine
- ELK.js replaces dagre — fully synchronous layout via FakeWorker bypass, better edge routing and subgraph handling
- Shape-aware edge clipping — edges terminate at actual shape boundaries (e.g. diamond vertices), not bounding boxes
- New layout options —
nodeSpacing,layerSpacing,componentSpacing,thoroughnessfor fine-grained control - Disconnected component support — graphs with unconnected subgraphs now lay out properly
- Per-subgraph direction overrides — nested subgraphs can have independent LR/TD/BT/RL direction
Multi-line Labels & Formatting
<br>tags in node labels, edge labels, and subgraph headers — line breaks work everywhere- Inline formatting —
<b>,<i>,<u>,<s>tags render as bold/italic/underline/strikethrough in SVG - Variable-width text measurement — character-class buckets (narrow, wide, CJK, emoji) instead of fixed-ratio estimation
Themeable ASCII
- ANSI color modes —
none,ansi16,ansi256,truecolor, andhtml(for browser rendering) AsciiThemetype — customize colors per role:fg,border,line,arrow,corner,junctioncolorMode: 'auto'— auto-detects terminal capabilities
ASCII Shapes
12+ distinct node shapes in terminal output:
rectangle, rounded, diamond, circle, hexagon, stadium, cylinder, doublecircle, subroutine, asymmetric, trapezoid, state-start, state-end
ASCII Rendering Improvements
- Edge bundling — fan-in/fan-out patterns merge into visual junctions (TD direction)
- Multi-line labels in both nodes and edges
- Multi-section boxes for class diagrams (name / attributes / methods) and ER diagrams
- Canvas role tracking — each character tagged with semantic role for accurate colorization
- Diagonal line validation —
assertNoDiagonals()for test assertions
SVG Renderer
- Semantic data attributes on all elements (
data-id,data-from,data-to,data-style,data-label) - Improved arrow markers — combined fill + stroke for crisp rendering at small sizes
- Better edge label pills — increased stroke width, improved contrast
Breaking Changes
- dagre removed — replaced by ELK.js (API unchanged, layout results differ)
tsup.config.tsremoved (no longer bundled separately)