Work on ASCII generator

Posted on October 2, 2017 by Martin Buck

I had to make some ASCII diagrams for source code documentation at work to better explain algorithms or data structures.
There’s already tools online that allow creating ASCII charts. Most of them are quite nice, but not as powerful as I’d like them to be, which forced me to do the diagrams by hand. The generators I saw so far seem to directly map shapes to their characters. For example a vertical line will always map to |, a corner always to + etc. This works quite well as long as shapes don’t intersect one another.
But once shapes intersect, the algorithm basically fails. It has to decide for one of the shapes at the intersection and drop all the others. This results in rather bad diagrams when many shapes are present.
I want to make this more general and robust by finding the most fitting character for all the overlaying shapes. We’ll see whether this approach will produce nice diagrams.

I started working on the server of the generator about a week ago. It’s implemented in Haskell and should later offer an API for web clients. The client will likely be a HTML page with a SVG editor, but I haven’t implemented anything client side yet.
Once there’s something to show I’ll either create another post or add a project page.