I’m not sure whether they launched this recently, or it was always there (As in
since I looked at D2 couple weeks ago)
Nevertheless, it is quite nice.
If one is not used to CLI and/or does not wish to (or can not, due to
permission on say work machine) install it locally, then playground the best
It has all the options the CLI provides (At least the most widely used options)
- export the images
- Change Engines
- Change Themes
What else do you need ? 😄
The playground also has sample code right below it, so one does not need to
refer to the documentation (Especially during initial days when one is still
figuring things out)
It was only a matter of time before there was Emacs mode for D2 😆
and here it is.
I’m yet to try it though.
D2 allows me to generate diagrams from the same source file using different layouts
It comes with two built-in layout engines :
Dagre is the default :
Other one is ELK This needs to be specified explicitly as :
D2_LAYOUT=elk d2 in.d2 out.svg and here is the output
I came across D2 on Mastodon I think. (Like most things. But I can’t find the original toot 🤷♂)
I used mermaid.js earlier. In fact, I also added mermaid support for this theme.
Benefit of Mermaid is that since it is generated by mermaid.js, I don’t need to save and include the image in my blog (and worry about mismatched filename and/or path, resulting into broken image.)
On the other hand, not many hugo themes support mermaid, but link to an image is supported by hugo and every other SSG.
Continue Reading »