Mermaid Gantt diagrams for displaying distributed traces in Markdown (2023)
brycemecum.com
brycemecum.com
Just look at tables in GFM, which mostly were designed as you propose. They look like tables even before rendering, however the experience of actually creating and editing the tables is not fun at all.
I have a horse in this race (co-founder of a markdown-based note-taking app) and to me, the benefit of markdown is easy + explicit editing, not that it looks the same in plain text vs rendered.
rST allows using a csv as a table and that’s mighty convenient. An other thing that’s mighty convenient is rST allows rendering a nested list as a table. It’s not amazing because each list item is a row rather than a column, but it is a lot less confusing than having to edit a markdown table if you’re not in a table-aware editor.
To me a more accurate title and summary of the article is "TIL: Mermaid Gantt diagram specifications can be embedded and processed in Markdown documents".
I completely disagree. The spirit of Markdown is to provide something that is a user-friendly, simple and easily works on most cases. The spirit of Markdown is not to bear with substandard, unreadable, and outright unfriendly documents just because ineffectiveness and lack of support for basic features is wrongly interpreted as simplicity.
Markdown supports images. Mermaid is nothing more than a way to simplify how developers can put together and maintain images without requiring specialized editors or additional software.
I didn’t see anything on the page about running the tool locally (remote code analysis is a deal breaker).
Anyone know if that’s an option?
There are local code <-> LLM interfaces though (CLI tools, editor extensions), and if you can figure out a suitable prompt you can get pretty similar experience. (Of course, you'll also want to run an LLM locally as well)
I built a file parser (in VBA, because that is what was available) to log every file reference to a big table, the generate graphviz code to visualize it.
It's easy to say "tons of stuff uses $datasource", but it's way better if you can show exactly how much and the impact of changes.
It was incredibly useful when we changed our domain and all network drive mappings broke.
https://files.techhub.social/media_attachments/files/112/836...
This could be easily ported to Github Workflows, because the logic is very simple.
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.
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.
IIRC the issue is that they rely on DOM manipulation for rendering (and node doesn't have a DOM). I can't think of a reason why Playwright as a mechanism would result in inconsistent output though, as long as you give the CLI the same theme/size/etc parameters as the original.
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.
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.
The main reason why we need a browser currently is size calculations of the SVG boxes, which libraries like jsdom does not support.
Mermaid diagrams do not render correctly using the following programs and libraries:
Adobe FrameMaker 2020
Apache Batik
EchoSVG
svgSalamander
resvg
rsvg-convert
svglib
prawn-svg
CairoSVG
ConTeXt
QtSVG
MS Word
PlutoSVGHowever 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.
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.
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
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.
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)
Looks like this: Out of office: [John Doe] [Stacy] Release: [code freeze] [Staging date] [Release!]
Out of office:
[John Doe]
[Stacy]
Release:
[code freeze]
[Staging date]
[Release!] Jan
1 2 3 4 5 6 7 8 9 ...
John X X X X X
Stacy X X X
Release CF FF1. What that has to do with markdown? I mean, that syntax isn't markdown nor does it require anything markdown-related to render AFAICT.
2. What mermaid is; the link itself doesn't explain it. I think this does, sort of:
https://mermaid.js.org/intro/
but then - how does this relate to graphviz, or gnuplot? I'm missing that information.3. Can I get something nice-and-compilable, not JS, for rendering these gantt charts into SVGs or what-not?
#2. Graphviz and gnuplot also render diagrams
#3. Sort of like asking if you can get a Markdown renderer in not JS: most direct answer is yes. If the Q is more "can Mermaid be rendered as SVG?", yes, the render format is SVG
I just tried the LIVE Editor: https://mermaid.live/
Yes, it does allow SVG export. Nice!
2. Mermaid is a diagram rendering tool similar to graphviz and D3.js. It uses a different syntax for each chart type with the intention of making it easy to write and to read when looking at markdown source.
3. You would need to use a separate program like graphviz to do the layout and generate an SVG, PNG or other file that you can reference in your markdown or other document files. If/when mermaid provides a similar capability you'll be able to use that instead.
.grid .tick line { opacity: 0.3; }https://www.chromium.org/developers/how-tos/trace-event-prof...
It looks like though the old catapult code has been officially deprecated, and they're recommending switching over to Perfetto.
https://github.com/google/perfetto
So anyhow, I just learned about the perfetto switch, so I won't try and dig up a link to the old way of formatting your traces to work with chrome://tracing, as it sounds completely deprecated. Go use Perfetto if you want a fairly easy way of interacting with trace data. I assume it's at least as good and useful as chrome://tracing.
This post is a little confusing, though, because this isn't markdown. It's mermaid's own markdown-like syntax for graphs/charts.
I wasn't expecting it to run client-side.
They fall down when you want to partially collapse the trace.
Mermaid supports either fully-collapsed, which will re-order your items, or not collapsed at all.
Its a dedicated text-to-timeline generator. Don't know if it can be embedded or available as a library too.
Also available for VS code[0] and Obsidian[1]
[0] https://marketplace.visualstudio.com/items?itemName=Markwhen...
I used this in the past, found it via HN: https://nomnoml.com/
Oh this is nice.