Ditaa: DIagrams Through Ascii Art

Tuesday 17 November 2009

Does ditaa do the impossible, or the unnecessary? It converts ASCII-art block diagrams into nice pictures. As the author puts it:

    
    +--------+   +-------+    +-------+
    |        | --+ ditaa +--> |       |
    |  Text  |   +-------+    |diagram|
    |Document|   |!magic!|    |       |
    |     {d}|   |       |    |       |
    +---+----+   +-------+    +-------+
        :                         ^
        |       Lots of work      |
        +-------------------------+

After conversion using ditaa, the above file becomes:

Nicely drawn diagram

I haven't tried it, so I don't know where the parsing falls down, but the samples in the doc sure look better than I thought they would...

Comments

[gravatar]
Jay 8:26 AM on 17 Nov 2009

It draws nice diagrams but you still have to do layout and drawing ASCII boxes is a PITA to me.

My use case for diagrams probably isn't normal but I almost always have some sort of data that I can munge into nodes and edges. (Program call graphs, DB schema, etc) or I make up nodes and edges in a text file. Then I use GraphViz to automagically do the layout and drawing. Works great for me.

[gravatar]
Ben 9:27 AM on 17 Nov 2009

@Jay: "and drawing ASCII boxes is a PITA"

... unless you're a crusty Emacs hacker, of course.

[gravatar]
rgz 10:04 AM on 17 Nov 2009

Apparently works for LaTeX.

[gravatar]
Brandon Thomson 10:11 AM on 17 Nov 2009

Yeah this looks pretty brilliant, nice find. One can draw ascii boxes very quickly in vim/emacs.

[gravatar]
lorg 11:50 AM on 17 Nov 2009

I thought of a similar thing once, but it was the other way around - diagrams to ascii-art.
I find the idea of translating vector graphics to ascii really interesting, I still hope to implement it someday.

[gravatar]
Val 3:37 PM on 17 Nov 2009

Yep, I'm with lorg -- I've got much more use for a (good!) diagram-to-ascii tool. I have Visio (for better/worse) for drawing my own diagrams. But if I'm posting a question here, or StackOverflow, etc., I need to embed the diagram in text, and referengcing images on some random site (even my own!) is guaranteed linkrot. Currently, I spend a fair amount of time drawing ascii diagrams by hand -- I niggle over the details way too much, but tell myself that's good because it keeps me thinking about what I'm trying to represent.

[gravatar]
James Rowe 12:46 AM on 18 Nov 2009

There is also aafigure, which does a similar task(not quite as much functionality). It is written in Python, produces various image formats, and integrates in to sphinx with sphinxcontrib-aafig.

ditaa definitively looks nice, but I've only played with it via the web interface(no java locally). Thanks for pointing it out!

[gravatar]
Jonathan Hartley 3:52 AM on 18 Nov 2009

People who like this might also like yuml.me, which converts simple GET args in the url (simple enough to compose by hand) into an image containing a correponding diagram:

http://yuml.me/diagram/scruffy/class/samples

[gravatar]
El 1:30 PM on 13 Jun 2011

http://www.asciiflow.com is good for drawing the initial diagrams

Add a comment:

name
email
Ignore this:
not displayed and no spam.
Leave this empty:
www
not searched.
 
Name and either email or www are required.
Don't put anything here:
Leave this empty:
URLs auto-link and some tags are allowed: <a><b><i><p><br><pre>.