What is meta? ×

The Request

This is a request to add Graphviz (DOT) support to Markdown. This will allow us to easily embed editable and indexable graphs in questions and answers. I imagine it will be particularly useful for the theoretical CS site and for Stack Overflow itself, but I think any site of the many we have in SE-2.0 and the original trilogy can enjoy graph support.

I get a feeling this is going to get a very low priority, but perhaps the implementation is simple and more people than I expect will want this.

Finally, here's what seems to be a proof of concept for embedding Graphviz in Python's Markdown implementation.

Usage Example

Example of what I mean - using the following (proposed) Markdown,

digraph {
    a -> b -> c;
    b -> d;

Will embed the image:

graphviz graph

Generating the image can be as simple as giving that text as input to a server-installed copy of Graphviz and asking it to generate an image in return. The final result is just an image, so I don't see any potential abuse or security problem here.

EDIT: a server-oriented module for generating diagrams, called WebDot, is also available directly from Graphviz's website.

Use Cases

There are currently over a hundred questions tagged on Stack Overflow, I'm guessing many of them would enjoy that feature, though obviously this isn't the use-case I am thinking about.

I've used Graphviz myself in two different posts I've made, but if anyone else knows of other posts that could have used it, feel free to add these examples here. My posts:

share|improve this question
I think .svg should be sufficient for this purpose; see edited answer below. –  Jeff Atwood Sep 18 '11 at 8:22
@Jeff SVGs are a lot harder to produce and edit than just writing a little text and immediately producing useful graphs. Text in SVGs is indexable, though, so that aspect is certainly addressed by your answer. –  Oak Oct 26 '11 at 17:10
@JeffAtwood I totally agree with Oak –  CAFxX Dec 8 '11 at 13:03
Inline Graphviz code could render to SVG and thereby be indexable. –  smokris Feb 11 '12 at 7:02
Totally agree with Oak, inline DOT is that easy while one had to start an external application like Inkscape in order to produce a complex SVG markup. –  mdo Mar 20 '13 at 7:35
SVG doesn't do graph layout. I use dot a lot. –  reinierpost Apr 5 '13 at 11:24
The point of having dot support: 1) dot can do the layout 2) no special editor needed. I would still love to see this. –  reinierpost Mar 3 at 13:53

1 Answer 1

Yes, please. Also, SVG support for basic animations and illustrations is incredibly useful. For example, http://upload.wikimedia.org/wikipedia/commons/d/d2/Pythagorean.svg

as a .png:


as a .svg:


as an animated .svg:


(this also works inline but it has odd sizing, so removed)

share|improve this answer
as you can see from my edit, this already works, at least in Chrome... –  Jeff Atwood Sep 18 '11 at 8:18
@JeffAtwood What is meant by "odd sizing"? It stays the same size while animated. I'd let it be there, animated. –  Camilo Martin Feb 20 '12 at 0:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .