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
Extension: Markdown Preview Mermaid Support v1.32.0
VS Code: 1.112.0
Description
\n sequences in node labels are rendered as text rather than line breaks.
It seems this is a regression introduced in Mermaid v11.0.0. It worked correctly in Mermaid 10.9.3. See mermaid-js/mermaid#6048.
Interestingly, mermaid.live renders \n correctly for the same diagram. It's not clear to me whether they're preprocessing the text or using different renderer logic.
Replacing \n with <br> works. I can actually only find <br> in the docs (link), but it seems many renderers support \n, including mermaid.live, GitHub's GFM, and (until its own regression) Mermaid.js itself.
I assume this could just be addressed by the upstream fix after it is available. However, given the original issue is 1.5 years old and only recently got a response, it may be helpful to have an interim fix to cover the gap, such as preprocessing \n in quoted labels to replace with <br>. This would resolve a lot of the confusion we're seeing with Markdown authored in other sources today, particularly as Markdown is becoming increasingly popular and important with the trend in documentation-centric approaches.
Environment
Description
\nsequences in node labels are rendered as text rather than line breaks.It seems this is a regression introduced in Mermaid v11.0.0. It worked correctly in Mermaid 10.9.3. See mermaid-js/mermaid#6048.
Interestingly, mermaid.live renders
\ncorrectly for the same diagram. It's not clear to me whether they're preprocessing the text or using different renderer logic.Example
Actual (Markdown Preview Extension)
Expected (GitHub)
graph TB A["Line one\nLine two"] B["GCP Origin\n(single region)"]Workaround
Replacing
\nwith<br>works. I can actually only find<br>in the docs (link), but it seems many renderers support\n, including mermaid.live, GitHub's GFM, and (until its own regression) Mermaid.js itself.I assume this could just be addressed by the upstream fix after it is available. However, given the original issue is 1.5 years old and only recently got a response, it may be helpful to have an interim fix to cover the gap, such as preprocessing
\nin quoted labels to replace with<br>. This would resolve a lot of the confusion we're seeing with Markdown authored in other sources today, particularly as Markdown is becoming increasingly popular and important with the trend in documentation-centric approaches.