Mermaid: Example export to SVG generates error

Created on 5 Jan 2018  路  7Comments  路  Source: mermaid-js/mermaid

The page's example: Larger flowchart with some styling

graph TB
    sq[Square shape] --> ci((Circle shape))

    subgraph A subgraph
        od>Odd shape]-- Two line<br/>edge comment --> ro
        di{Diamond with <br/> line break} -.-> ro(Rounded<br>square<br>shape)
        di==>ro2(Rounded square shape)
    end

    %% Notice that no text in shape are added here instead that is appended further down
    e --> od3>Really long text with linebreak<br>in an Odd shape]

    %% Comments after double percent signs
    e((Inner / circle<br>and some odd <br>special characters)) --> f(,.?!+-*夭)

    cyr[Cyrillic]-->cyr2((Circle shape 袧邪褔邪谢芯));

     classDef green fill:#9f6,stroke:#333,stroke-width:2px;
     classDef orange fill:#f96,stroke:#333,stroke-width:4px;
     class sq,e green
     class di orange

If exported to SVG, it returns this as an error:

This page contains the following errors:
error on line 7 at column 4440: Opening and ending tag mismatch: br line 0 and div
Below is a rendering of the page up to the first error.

Most helpful comment

@tylerlong I'm still getting the error and using <br/> wont't help. Here's the example from @marceloboeira

Error when opening the svg with current Chrome: error on line 352 at column 4922: Opening and ending tag mismatch: br line 0 and span

All 7 comments

I confirmed this issue. And there is an easy fix: After you export the svg file, replace all <br> with <br/>.

I have updated https://mermaidjs.github.io/mermaid-live-editor/. So if you download a SVG file there, <br>s are already replaced with <br/>s.

I also updated the mermaid file so it will auto convert <br> to <br/>.

@tylerlong thanks!

@tylerlong I'm still getting the error and using <br/> wont't help. Here's the example from @marceloboeira

Error when opening the svg with current Chrome: error on line 352 at column 4922: Opening and ending tag mismatch: br line 0 and span

I have mismatched tags br, line and div. The svg renders correctly in the editor, obviously, but the downloaded svg doesn't work. Strangely, selecting the correctly rendered svg in the browser and saving it also doesn't work.

@tylerlong I'm still getting the error and using <br/> wont't help. Here's the example from @marceloboeira

Error when opening the svg with current Chrome: error on line 352 at column 4922: Opening and ending tag mismatch: br line 0 and span

Or see here for a minimal example. The "Download SVG" option always seems to convert <br/> to <br> so I guess something's regressed here. Opening the downloaded SVG in a text editor and manually converting back to <br/> fixes it as expected.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pirDOL picture pirDOL  路  3Comments

michaeltlombardi picture michaeltlombardi  路  3Comments

lwalker-kforce picture lwalker-kforce  路  3Comments

deftdawg picture deftdawg  路  3Comments

chen4221 picture chen4221  路  3Comments