Skip to content

generateMermaidDiff

function generateMermaidDiff(params): MermaidDiffOutput;

Defined in: src/diff.ts:537

Generate Mermaid diff code comparing two AWS Step Functions ASL definitions.

Produces stateDiagram-v2 syntax where added states are green, modified states yellow, and removed states red (via Mermaid classDefs) — rendered natively by GitHub, GitLab, and docs tooling with no image hosting required. Removed states are kept as orphan nodes so they stay visible, unless catchHandling: 'hide' is set, which drops them like any other state unreachable from StartAt (as generateDiff does).

GenerateMermaidDiffParams

The diagram options plain generateMermaid honours: catchHandling, catchLabelStyle, collapse, customColors, includeComments, layout, showVariables and theme

MermaidDiffOutput

MermaidDiffOutput with Mermaid code and a per-category state summary

A state the diff marks keeps its diff class, so customColors shows only on unchanged states. With collapse set, a changed state inside a collapsed container’s placeholder is flagged on the placeholder instead, as in generateDiff: the amber (modified) class plus a "<n> changed inside" annotation, unless the container itself is added or removed.

const { code } = generateMermaidDiff({ after: headAsl, before: baseAsl, collapse: true });