← All updates

State diagram transition labels now sit on their arrows

A label like "Submit" or "Request Changes" used to float beside its transition arrow. It is now centred on the line, over a page-colour gap, the same way flowchart edge labels are.

mermaidmarkdowndiagrams

A stateDiagram-v2 transition label — the text after the colon in Draft --> Review : Submit — was drawn wherever the layout engine parked it, which is beside the route rather than on it. Every label in a state diagram therefore floated next to its arrow, and on a diagram with a forward and a back transition between the same two states ("Submit" and "Request Changes", say) the two labels read as unrelated to either line.

Each label is now centred on its own routed edge, over a knock-out in the page colour so the line does not run through the text — the same treatment flowchart edge labels already get. When two labels would land on top of each other, one slides along its own route until the two are clear, so neither label disappears under the other's background.

This applies everywhere Mermaid is rendered: fenced ```mermaid blocks in POST /api/v1/md, the canvas renderer, the CLI, and the /mermaid/state syntax page. If you have a state diagram with labelled transitions, render it again to get the centred labels.