mermaid-js / mermaid

Generation of diagrams like flowcharts or sequence diagrams from text in a similar manner as markdown
https://mermaid.js.org
MIT License
71.18k stars 6.41k forks source link

Mindmap generates a non-valid SVG #5186

Open manuel-rubio opened 9 months ago

manuel-rubio commented 9 months ago

Description

I'm creating a mindmap to export as SVG, it's shown in Google Chrome, and even it's possible to be opened using Gimp, but when I use other software like AsciiDoctor-PDF or Inkscape, it's not working.

The file MMD file contains:

mindmap
  branch1((ALGOL 60))
    root((ALGOL 58))
      PL/I
      MAD
        GOM
      JOVIAL
        CORAL
    ALGOL X + ALGOL Y
      branch2((ALGOL 68))
        ALGOL N
    ALGOL W
      PASCAL
    Simula
    CPL
      BCPL
        B
      COWSEL
        POP-I
    Euler
    IMP
    Edinburgh IMP

The file generated is this one: algol_legacy

Steps to reproduce

  1. Place the content of the MMD file showed in the description inside of a algol_legacy.mmd file.
  2. Use the mmdc (version 10.6.1) and run this:
    mmdc -s 100 -t forest -i algol_legacy.mmd -o algol_legacy.svg
  3. Open the SVG generated file using Inkscape or simply running this:
    convert algol_legacy.svg algol_legacy.png

    Note that I used ImageMagick 7.1.1-23, then you can see the result: algol_legacy

Screenshots

No response

Code Sample

No response

Setup

Suggested Solutions

No response

Additional Context

No response

manuel-rubio commented 9 months ago

Using inkscape you can see more information about SVG errors: image

manuel-rubio commented 9 months ago

Ok, I found that removing this:

        #my-svg :root {
            --mermaid-font-family: "trebuchet ms", verdana, arial, sans-serif;
        }

And the style from this:

<svg aria-roledescription="mindmap" role="graphics-document document" viewBox="5 5 847.6700439453125 610.7256469726562"
    style="max-width: 847.67px; background-color: white;" xmlns:xlink="http://www.w3.org/1999/xlink"
    xmlns="http://www.w3.org/2000/svg" width="100%" id="my-svg">

That's good enough to get it working.