mermaid-js / mermaid-cli

Command line tool for the Mermaid library
MIT License
2.44k stars 232 forks source link

Quotes around font-family in scss files makes svgs susceptible to line-wrap corruption #84

Open ahl opened 3 years ago

ahl commented 3 years ago

Is your feature request related to a problem? Please describe. When used from https://github.com/asciidoctor/asciidoctor-diagram svgs generated by github.com/mermaid-js/mermaid-cli are line-wrapped which causes them to be corrupted. While clearly asciidoctor-diagram should not be doing this (asciidoctor/asciidoctor-diagram#308) I believe mermaid could make a simple fix to correct this.

Describe the solution you'd like If the font-family were not surrounded by quotes (") line wrapping in the middle of the name of the default font family (trebuchet ms) seems to be processed fine. I'd propose that themes' scss files drop the quotes.

Describe alternatives you've considered Fix asciidoctor-diagram. In the interim, specifying a mermaid config file like this causes the quotes to be dropped:

{
  "fontFamily": "trebuchet ms"
}

Additional context I initially filed this here https://github.com/mermaid-js/mermaid/issues/1788 but @knsv suggested I filed it in this repo.

bottee commented 2 years ago

This bug can easily be reproduced with markdown-output.md from the test-positive folder in this repository and mogrify from imagemagick:

./node_modules/.bin/mmdc -i ./test-positive/markdown-output.md -o markdown.md
mogrify -trim markdown-1.svg
mogrify -trim markdown-2.svg

mogrify on markdown-1.svgworks, but returns following error on markdown-2.svg:

mogrify: non-conforming drawing primitive definition `sans-serif"' @ error/draw.c/RenderMVGContent/4466.