Giter Site home page Giter Site logo

Comments (11)

daladim avatar daladim commented on August 11, 2024

Same issue if I use <br> tags instead of <br/> tags

from mermaid-cli.

MindaugasLaganeckas avatar MindaugasLaganeckas commented on August 11, 2024

This is issue is the same/related to mermaid-js/mermaid-live-editor#26 and can be solved the same way.
@daladim : would you like to work on a PR?

from mermaid-cli.

daladim avatar daladim commented on August 11, 2024

Hi. Thanks for the info.
I am not sure I am experienced enough in JavaScript to make the PR myself, but let's see.

Jihchi has worked around this limitation in mermaid.ink. It is very simple and effective. It indeed is a warkaround, but I can't see any use case where a <br> (that would not be an actual line break) would mistakenly be tampered by this workaround.

Otherwise, since <br>is correct HTML and <br/> is required for XML/XHTML compatibility, we might want to use an XMLSerializer instead of a plain .innerHTML. This would be slightly more complex than the workaround above, but might work as well.

What is your opinion on this?

from mermaid-cli.

MindaugasLaganeckas avatar MindaugasLaganeckas commented on August 11, 2024

You are welcome to choose the solution yourself. A workaround is good enough, if it is faster to implement. We can always improve things 😄

from mermaid-cli.

MindaugasLaganeckas avatar MindaugasLaganeckas commented on August 11, 2024

@daladim : thank you so much for your contributions so far. I have tried the svg file with the <br> and it does not give me any error in Firefox. https://github.com/mermaid-js/mermaid-cli/suites/1670560212/artifacts/31151542
The output of svg->png is different than just svg in Firefox for your test file. But no error is shown by the browser.
My Christmas proposal; please, implement the fix, leave the test file, add only a single test (no for loop) and I will gladly accept your contribution. If needed, I will perform a manual verification of the output svg file.

from mermaid-cli.

daladim avatar daladim commented on August 11, 2024

It is strange that you don't get any error in Firefox on your side...
I have just checked the .zip file you mentioned. Both Firefox 83.0 on Ubuntu 20.04 and Firefox 84.0.1 on Windows 10 display the Expected: </br> error on my computer when I open graph-with-br.mmd.svg, and this is the only .svg for which Nautilus does not display a preview...
Anyway, I'll push the fix as you asked asap (and sorry for the Christmas delays!)

from mermaid-cli.

MindaugasLaganeckas avatar MindaugasLaganeckas commented on August 11, 2024

@daladim : can I close this issue?

from mermaid-cli.

daladim avatar daladim commented on August 11, 2024

Well, this depends on what you think about the associated MR #79 that you've merged.

This merged MR should indeed fix the issue, but you mentioned errors that you kept having. As I can't remember how to test locally (it's been a long time, and I'm not a node/JS expert :-p ) I could not check that master was correct.

To be sure, I can test it if there was a tagged Docker image somewhere.

Please tell me how you want to proceed.
Thanks

from mermaid-cli.

kyww avatar kyww commented on August 11, 2024

Just run this command on the generated svg file as a workaround:
sed 's#<br>#<br/>#g' -i output.svg

from mermaid-cli.

MindaugasLaganeckas avatar MindaugasLaganeckas commented on August 11, 2024

Fixed by #171

from mermaid-cli.

n0r avatar n0r commented on August 11, 2024

I've just installed mermaid-cli via brew.
When running mermaid-cli against mermaid files containing <br> im still facing this error. @kyww's workaround fixes the previously rendered SVG.

from mermaid-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.