-
-
Notifications
You must be signed in to change notification settings - Fork 6.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Line breaks are rendered as <br> and not <br/> in the resulting svg file, resulting in parsing errors for external svg parsers #1766
Comments
What a silly problem. We must fix this. |
@frederikfab The issue is when we parse and prepare to render the SVG, it has the proper <br/> closing tag, but in the case when the setting is htmlLabel =true, then, we rely on the native SVG.innerHTML() to render/draw it, and that gives back only <br>. For your case I would recommend you try using the setting htmlLabel=false, then you should get the desired result, as here we have better control over how we break the label even before we style it, instead of depending on HTML rendering by the browser. Let us know if this fixes your issue. |
I have tried to set this option, but it does not seem to make a difference. I think i might be doing it wrong though:
|
also tried adding an s to htmlLabels above, made no difference. In my workflow, I am using the markdown mermaid extension in vscode, so I do not control how the mermaid library is initialized - I understand if you see that as a requirement for addressing this, though. |
rendering my graph
using
as a config file works! Line breaks are now rendered. |
@frederikfab |
It may still be an issue, or I'm definitely facing a different one,
I'm using version : 10.1.0 with If it is believed to be another issue, I'll open a new one and delete this comment here (to avoid pollution with non-issue related comment here).
|
This error is because SVG is expected to be XML. The use of Currently, this mermaid
generates this image: flowchart TD
F(Finance) --- F.1["F.1 Reuse Know
your customer"]
which has this html <span class="nodeLabel"><p>F.1 Reuse Know<br>your customer</p></span> That It should be FWIW, we are trying to use mermaid in specifications at the W3C and their new tooling requires strict parsing of SVGs. So this is a gating factor to continue to use mermaid. =( It looks like this should have been fixed in jupyterlab/jupyterlab#15661 but as pointed out in jupyterlab/jupyterlab#15661 (comment) the PR doesn't solve the problem with newlines in the mermaid, as illustrated above. |
Describe the bug
Line breaks are rendered as
<br>
and not<br/>
in the resulting svg file, resulting in parsing errors for external svg parsersTo Reproduce
Render the diagram
<br/>
gets rendered as<br>
Expected behavior
<br/>
and<br>
and<br />
should get rendered as<br/>
to be valid xml and parse correctly in more parsers.The text was updated successfully, but these errors were encountered: