D2 Diagrams - TALA - d2lang - What would an elegant integration with hugo look like?

I recently stumbled onto D2 D2lang[1] … and was wondering what the most intuitive integration might look like.

At first blush, I thought that, similar to mermaid, a goldmark extension[2] [3] to render them made the most obvious sense…

However, With the ability to create multiple pages of a diagram within d2, and d2 being written in golang[4] I thought that maybe there was a more elegant/obvious/programatic integration that would be more useful…

I could see it being pretty slick…

I looked around on Der Innerwebz™️, but didn’t see much in the way of exploratory work to wire Thing A(D2) into Socket B(Hugo)…
and so it seemed like reaching out here to see if anyone else has played around with integrating the two would be a good next step…

Hope y’alls universes are as awesome as possible.


  1. https://d2lang.com ↩︎

  2. https://github.com/FurqanSoftware/goldmark-d2 ↩︎

  3. https://github.com/antonklava/goldmark-d2 ↩︎

  4. https://github.com/terrastruct/d2 ↩︎

  5. https://victorbjorklund.com/build-diagrams-as-code-with-d2-d2lang ↩︎

  6. https://github.com/HariSekhon/Diagrams-as-Code ↩︎

This may be helpful. Use a code block render hook with Kroki’s HTTP API.