Rendering graphviz diagrams in gitiles markdown documentation

297 views
Skip to first unread message

Robert Flack

unread,
Mar 27, 2019, 2:30:24 PM3/27/19
to Chromium-dev
TLDR; I'd like to make it cheap and easy to include / update diagrams in markdown.

If you're not familiar with it, graphviz is a tool for automatically laying out and rendering a simple textual representation of a graph. There are a bunch of examples on their gallery page and you can play with a web version at viz-js.com. I think that it's well suited for easily generated and modifiable diagrams in our documents.

Naively, using graphviz today in gitiles requires manually generating and checking in the png file generated from the .dot file. Then include the generated image in your markdown. Ideally we'd use SVG (smaller, scales nicely) except gitiles markdown images currently only support png, jpg and gif unless the image is remote.

This is not ideal, and while you could imagine workarounds like making the generation part of the build I suspect linking to the build artifacts from the source may be difficult and subject to version skew. We could add a PRESUBMIT hook to verify that updated .dot files match their generated output to ensure that devs don't forget to freshen the output file.

I think there are several ways we could make this as easy as just including the .dot file:
  • Run a web service similar to gravizo which responds to HTTP requests containing graphviz diagrams in the query parameter with the generated image. Embed graphviz within markdown as part of image link.
  • Use a gitiles plugin to render embedded graphviz
  • Include a library which can render embedded graphviz diagrams client-side, e.g. https://github.com/dagrejs/dagre
Adding support for this as a gitiles plugin (does one exist?) seems like the best solution, but I'd appreciate feedback / opinions / existing solutions we might be able to use if you're aware of them.

Dirk Pranke

unread,
Mar 27, 2019, 2:44:25 PM3/27/19
to Robert Flack, Chromium-dev
I think this is a good idea.

Ideally we'd get this via a gitiles extension. I am not aware of one currently for graphviz, but the code isn't too hard to work on so it might be easiest to just add support there. I'll cc' you on a thread with the internal Google team that works on Gitiles.

If that doesn't work, then, yeah, we'd have to adopt some other approaches that are certainly doable but that I'm less wild about :).

-- Dirk

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAJh39TO5%3DNzPi%2BjgK90fBP1qCVEdq5KGZ2krD3WJjzdby2ZgSw%40mail.gmail.com.

methew

unread,
Mar 27, 2019, 11:42:48 PM3/27/19
to dpr...@chromium.org, Chromium-dev, Robert Flack
by bpastene on slack.
There's an google-internal bug to add support for graphviz (b/37409950)

2019년 3월 28일 (목) 오전 3:43, Dirk Pranke <dpr...@chromium.org>님이 작성:
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/CAEoffTCaZDkiA-eq0Lw1LnSHZq9-8xLKvBWMYkrzttt%2BHmyg_A%40mail.gmail.com.

Dirk Pranke

unread,
Mar 28, 2019, 6:09:02 PM3/28/19
to Robert Flack, Chromium-dev
Just as a bit of follow-up ... Robert and I are discussing options with the Gerrit team, and I will report back when we reach some sort of conclusions.

-- Dirk

Raymond Toy

unread,
Mar 29, 2019, 3:40:03 PM3/29/19
to Dirk Pranke, Robert Flack, Chromium-dev
While we're on this topic, what about nicely rendered math (TeX) equations?

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

Dirk Pranke

unread,
Mar 29, 2019, 4:59:24 PM3/29/19
to Raymond Toy, Robert Flack, Chromium-dev
That is another fine suggestion :).

-- Dirk

Daniel Murphy

unread,
Nov 21, 2019, 5:30:39 PM11/21/19
to Chromium-dev, Dirk Pranke, Robert Flack, Chromium-dev, Raymond Toy
+1 vote from me (doing this manually right now, trying to use svg but that also doesn't seem to work)

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev+unsubscribe@chromium.org.

Shane Hansen

unread,
Nov 21, 2019, 6:00:31 PM11/21/19
to dmu...@google.com, Chromium-dev, Dirk Pranke, Robert Flack, Raymond Toy
In the past I've used something like this to do things client side: https://github.com/magjac/d3-graphviz



To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
---
You received this message because you are subscribed to the Google Groups "Chromium-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.
To view this discussion on the web visit https://groups.google.com/a/chromium.org/d/msgid/chromium-dev/90b5d889-7204-4e25-87c1-776a01bba87c%40chromium.org.

dan...@chromium.org

unread,
Mar 31, 2020, 1:56:32 PM3/31/20
to Dirk Pranke, Robert Flack, Chromium-dev
Did anything come of this? I am drawing some graphs of how content shell is structured and putting them into markdown once they are settled would be nice.

Reply all
Reply to author
Forward
0 new messages