npm / @mermaid-js/layout-elk
@mermaid-js/layout-elk
What changed in @mermaid-js/layout-elk 0.2 to 1, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-27.
6 breaking2 new APIs and options1 performance3 behavior and defaults3 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli init@mermaid-js/layout-elk 113 changes
Breaking changes 6
Adds edge-crossing line hops, enabled by default. Set false for plain crossings or 'gap' to use gaps instead of arcs.
Adds named combinations of layout options: default, legacy, modelOrder, and depthFirst. The new default changes existing ELK diagram layouts; legacy restores the previous rendered behavior.
Existing ELK diagrams now use balanced node-placement alignment and depth-first cycle breaking by default, so their layouts can differ; preset: legacy restores the previous behavior.
A margin of 12 is now reserved at the ends of every side so ELK keeps ports off node corners, reducing edges that leave from corners.
Small steps next to nodes are removed by aligning the channel with the port row. Set false to keep the previous behavior.
Mermaid now targets ES2024 and Safari 17.4+; older browsers may need polyfills or transpilation. Node.js v22.12+ is declared as a package requirement.
Performance 1
The core entry now defers to the host's Mermaid instead of inlining a separate copy, reducing bundle size and ensuring Mermaid rendering fixes reach the ELK layout path.
Behavior and default changes 3
Mermaid bundles and registers ELK automatically, so most projects can drop this dependency and the registerLayoutLoaders call. The package remains usable to add ELK to mermaid.tiny.js builds.
Edges leaving non-rectangular shapes now attach along their departure axis, keeping the opening segment straight and orthogonal.
Subgraph frames are drawn at an even distance from their children while routing lanes remain outside the frame, making groups tighter and less lopsided.
Fixes and other changes 3
With ELK, class cardinality labels are placed beside their relation ends on dagre's sides, centred on dagre's ends, and no longer clipped.
Anchors displaced off-center by the ports-surrounding margin are discarded for nodes narrower than 24px, so edges aim at the node center.
Title padding is reserved before ELK routes edges so attachments stay on the painted frame; stale interior endpoints are clipped along the incoming segment.
@mermaid-js/layout-elk 0.22 changes
New APIs and options 2
Adds a configuration option to keep a recursive flow's entry node on top.
Adds the
elk.nodePlacementAlignmentconfiguration option.