MermaidJS: Suppress using HTML tags in SVG documents
See original GitHub issueMermaidJS, by default, uses tags that only render inside of web browsers (foreignObject
and div
). A number of issues have been logged against MermaidJS to address this problem:
- https://github.com/mermaid-js/mermaid-cli/issues/103
- https://github.com/mermaid-js/mermaid/issues/2102
- https://github.com/mermaid-js/mermaid/issues/2485
- https://github.com/mermaid-js/mermaid/issues/2688
Issue 2688 recommends:
{
"flowchart": {
"htmlLabels": "false"
}
}
What would be involved in revising Kroki to configure MermaidJS to avoid using HTML tags for all diagrams so as to generate more conformant SVG documents?
KeenWrite invokes Kroki using an HTTP GET request, so ideally the server could be configured to set htmlLabels
to false
, which would then allow KeenWrite to display the SVG files without modification:
Alternatively, it looks like Kroki supports HTTP GET URL parameters for setting options:
https://docs.kroki.io/kroki/setup/usage/#_options
See also:
Issue Analytics
- State:
- Created 9 months ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Replace foreignObject with standard SVG · Issue #2688 - GitHub
An SVG file generated by Mermaid cannot be edited using Inkscape (all boxes are ... MermaidJS: Suppress using HTML tags in SVG documents...
Read more >html - Strange output when converting SVG to PDF javascript ...
Update 2: So I noticed that if I change the foreignObject's in the svg nodes to <text> elements and remove the div, I...
Read more >SVG files created by Mermaid are displayed incorrectly - GitLab
Summary: An SVG exported by Mermaid live editor displays correctly in the browser, but using Inkscapes it's displayed all wrong.
Read more >Mermaid Graphs and Flow Charts
It combines HTML and a form of Markdown with JavaScript to create SVG images of flows and other charts, which can be styled...
Read more >Making Mermaid Diagrams in Markdown - CSS-Tricks
Using the same markup abstractions Markdown provides to notate code, Mermaid can be represented the same to output diagrams and flowcharts.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I was referring to the “internal” requests between Kroki containers. We will still support all the options when sending a request to the gateway server.
Kroki supports diagram options: https://docs.kroki.io/kroki/setup/usage/#_options
Currently, the gateway server calls the mermaid companion container with the diagram options but the mermaid service does not use them.
We are using the following default Mermaid configuration: https://github.com/yuzutech/kroki/blob/main/mermaid/src/task.js
So what we need to do is:
As a workaround, I think you can use a directive:
https://mermaid-js.github.io/mermaid/#/./directives?id=declaring-directives
As a side note, I’m leaning toward HTTP headers (rather than query parameters) to send diagram options to a companion container:
https://github.com/yuzutech/kroki/blob/f953fcf117053ea00c47d45caec5bb3b5ad897d4/server/src/main/java/io/kroki/server/action/Delegator.java#L33-L37