You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Mermaid.js should add support for \n inside edge labels in flowcharts to allow multiline edge text. This would make flowcharts more readable, especially when labeling complex transitions or actions with longer descriptions. It improves clarity without changing existing syntax and is backward-compatible.
Example
graph TD
A -->|"This is a long\nmultiline label"| B
B -->|"Another\nExample"| C
This should render as:
This is a long
multiline label
and
Another
Example
Screenshots
Current Behavior:
The text was updated successfully, but these errors were encountered:
Mermaid's edge labels in flowcharts are rendered using SVG text elements via D3 inside the flowRenderer.ts file. Currently, labels are rendered as plain strings directly onto the path using , and the renderer doesn’t split or handle multiline content. Implementation Plan
To support \n line breaks in edge labels, the following approach is suggested:
Detect \n in the label text Before appending the label, check if it includes \n. Example: const lines = label.split('\\n');
Create a for each line
Inside the or element, render each line using a tag and offset vertically using dy:
Proposal
Mermaid.js should add support for \n inside edge labels in flowcharts to allow multiline edge text. This would make flowcharts more readable, especially when labeling complex transitions or actions with longer descriptions. It improves clarity without changing existing syntax and is backward-compatible.
Example
This should render as:
and
Screenshots
Current Behavior:
The text was updated successfully, but these errors were encountered: