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
fix: Restore proper rendering of plain text flowchart labels without auto line-wrapping
6
+
7
+
This fix restores backwards compatibility with Mermaid v10 by ensuring that plain text labels in flowcharts are rendered correctly. In Mermaid v11, all labels were incorrectly being treated as markdown by default, which caused issues with text wrapping, multiline breaks, and backwards compatibility.
8
+
9
+
**What changed:**
10
+
11
+
- Plain text labels in flowcharts (without markdown syntax) now render as regular text
12
+
- For node labels and edge labels, these will line-wrap automatically. Although this isn't backwards compatible with v10, we think this is a minor change and it's worth keeping to avoid too many changes from diagrams created from v11 onwards.
13
+
- Plain text labels in other diagrams will continue to not line wrap.
14
+
- Plain text labels with `\n` characters now correctly create line breaks
15
+
- Plain text that looks like markdown (e.g., "1.", "- x") is no longer misinterpreted
16
+
17
+
**If you want markdown formatting:**
18
+
You can still use markdown in your flowchart labels by using the proper markdown syntax. Wrap your markdown text with double quotes and backticks:
19
+
``node["`_markdown_ **text**`"]``
20
+
21
+
Example:
22
+
23
+
````markdown
24
+
```mermaid
25
+
flowchart TD
26
+
plain["Plain text\nwith manual line break"]
27
+
markdown["`This is a **markdown** _label_ that wraps and doesn't replace \n with newlines`"]
Copy file name to clipboardExpand all lines: docs/config/setup/mermaid/interfaces/ParseResult.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,15 @@
10
10
11
11
# Interface: ParseResult
12
12
13
-
Defined in: [packages/mermaid/src/types.ts:97](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L97)
13
+
Defined in: [packages/mermaid/src/types.ts:98](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L98)
14
14
15
15
## Properties
16
16
17
17
### config
18
18
19
19
> **config**: [`MermaidConfig`](MermaidConfig.md)
20
20
21
-
Defined in: [packages/mermaid/src/types.ts:105](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L105)
21
+
Defined in: [packages/mermaid/src/types.ts:106](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L106)
22
22
23
23
The config passed as YAML frontmatter or directives
24
24
@@ -28,6 +28,6 @@ The config passed as YAML frontmatter or directives
28
28
29
29
> **diagramType**: `string`
30
30
31
-
Defined in: [packages/mermaid/src/types.ts:101](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L101)
31
+
Defined in: [packages/mermaid/src/types.ts:102](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L102)
32
32
33
33
The diagram type, e.g. 'flowchart', 'sequence', etc.
Copy file name to clipboardExpand all lines: docs/config/setup/mermaid/interfaces/RenderResult.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,15 @@
10
10
11
11
# Interface: RenderResult
12
12
13
-
Defined in: [packages/mermaid/src/types.ts:115](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L115)
13
+
Defined in: [packages/mermaid/src/types.ts:116](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L116)
Defined in: [packages/mermaid/src/types.ts:133](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L133)
21
+
Defined in: [packages/mermaid/src/types.ts:134](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L134)
22
22
23
23
Bind function to be called after the svg has been inserted into the DOM.
24
24
This is necessary for adding event listeners to the elements in the svg.
@@ -45,7 +45,7 @@ bindFunctions?.(div); // To call bindFunctions only if it's present.
45
45
46
46
> **diagramType**: `string`
47
47
48
-
Defined in: [packages/mermaid/src/types.ts:123](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L123)
48
+
Defined in: [packages/mermaid/src/types.ts:124](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L124)
49
49
50
50
The diagram type, e.g. 'flowchart', 'sequence', etc.
51
51
@@ -55,6 +55,6 @@ The diagram type, e.g. 'flowchart', 'sequence', etc.
55
55
56
56
> **svg**: `string`
57
57
58
-
Defined in: [packages/mermaid/src/types.ts:119](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L119)
58
+
Defined in: [packages/mermaid/src/types.ts:120](https://github.com/mermaid-js/mermaid/blob/master/packages/mermaid/src/types.ts#L120)
0 commit comments