(no title)
random_i | 1 year ago
It is very difficult to save the images as bitmap (.jpeg, .mpng) or vector (.svg).
You basically have to use a headless browser rendering toolkit, and guess what? The images aren't consistent (different rendering styles).
I'm switching to Graphviz (DOT-based) which can look just as nice and has tons of file save features.
sidharthv|1 year ago
The main reason why we need a browser currently is size calculations of the SVG boxes, which libraries like jsdom does not support.
teruakohatu|1 year ago
doublesocket|1 year ago
otherflavors|1 year ago
strken|1 year ago
mananaysiempre|1 year ago
There’s a reason why there’s SVG then there’s SVG Tiny then (recently, not approved by any standards process) there’s SVG Tiny PS. But as far as I can tell, there still isn’t any broad agreement on what subset of SVG is sane for dumb graphics consumed by (relatively) dumb rasterizers.
arminiusreturns|1 year ago
I've evaluated every diagrams-as-code tool in existence just about, and revisit them every year or two, and I keep coming back to blockdiag. Mermaid looked nice but had many issues I ran into.
blockdiag doesn't look as pretty out of the box, but when done right it looks really good, especially as an SVG
el_oni|1 year ago
[0] https://d2lang.com/
otikik|1 year ago
thangalin|1 year ago
Mermaid diagrams do not render correctly using the following programs and libraries:
mahdi7d1|1 year ago
However mermaid's experience and output is definitely subpar. Under the saved graphs section you find randomly saved graphs and there is no way to organize multiple graphs in the web editor.
I've even thought of writing a simple script to translate mermaid charts into dot language.
Karliss|1 year ago
A potentially much bigger difference in verbosity comes from graphviz being a general purpose graph drawing software, while mermaid is more of a software for drawing software development related diagrams (not just graphs and tables). This is well reflected by the fact that in graphviz the diagram types are categorized by layout engine (hierarchical drawing, spring model, force directed placement, circular layout,...), but in Mermaid they are categorized by what data the diagram represents (flowchart, sequence diagram, class diagram, state diagram, entity relationship diagram, gant diagram). You can draw many of those types of diagrams in Graphviz but you will have to potentially do a lot more of reinventing the wheel and low level manual formatting (arrow and node shapes, line style, etc.), while Mermaid documentation uses more of diagram specific terms like cardinality, visibility(public, private, ...) and many others.
That's like comparing Excel with purpose built accounting software or an inventory management system. Excel might be a lot more flexible, but if the usecase specific software matches your needs it can be a lot more streamlined and less error prone.
So the conclusions will very much depend on your use case. If you are trying to draw one of the standard software engineering diagrams as part of design documentation, Mermaid can be great. For less formal design diagrams or quickly visualizing the state of some algorithm it's much more even playing field.
prepend|1 year ago
But this is only if I need to put it in a paper or something as otherwise just point the user to the diagram in a browser.
It is still much better than any alternative I can think of.
boomskats|1 year ago
If you're looking at a rendered Mermaid diagram on your screen, you probably already have the SVG in your browser's dom. You can just right click -> view source -> find element -> view as html -> save that to a file. I expect this is how the SVG export on the Mermaid live editor[0] works.
(the Mermaid live editor is great, it's where I tend to go if I want an SVG export)
[0]:https://mermaid.live/
breck|1 year ago
Compiling to JPG, SVG, PDF, MKV, MP4, et cetera, are high on my todo list, but I really haven't seen a standout way to do that, beyond that would run through Chromium.
I wonder if Ladybird (https://ladybird.org/) might be appropriate for that use case? Not sure if it's a new rendering engine or what.
steve1977|1 year ago
coldtea|1 year ago
Huh? It's quite trivial, and even some tools for VS Code and other environments support it.
>You basically have to use a headless browser rendering toolkit, and guess what? The images aren't consistent (different rendering styles)
Is your problem saving Mermaid as images or lamenting cross browser rendering consistency?
If it's the former, why is the latter a problem? Use a single headless browser rendering toolkit and stick with it. Who said you need to use multiple and compare?
And there are other ways to do it, like exporting from an actual in-browser render, or even a VS Code extension - it can also be found in other tools based on Electron.