Skip to content
kd
5 Jun 2020
Back to blog

Drawing in ASCII

We can define a lua filter for pandoc that takes a code block that has the language defined as render_svgbob, and passes the text inside that code block to svgbob.

Here is a simple 3-bus circuit diagram using text / ascii:

```svgbob
           |           +-----------+           |
           +-----------+           +-----------+
           |           +-----------+           |
     +-----+1               y12               2+------+
     |     |                                   |      |
     |     +-+                               +-+      |
   .-+-.   |  \                             /  |    .-+-.
   |   |       \                           /        |   |
   |   |y1    .-+-.                     .-+-.     y2|   |
   '-+-'       \   \ y13          y23  /   /        '-+-'
     |          \   \                 /   /           |
     |           '-+-'               '-+-'            |
  -------           \                 /            -------
    ---              +               +               ---
     -               |        3      |                -
                  ---+-------+-------+---
                             |
                           .-+-.
                           |   |
                           |   |y3
                           '-+-'
                             |
                             |
                          -------
                           -----
                             -
```

And with svgbob, it looks like this:

1 y12 2 y1 y2 y13 3 y3 y23

Share this post on:

The egg tower puzzle
Neovim + LanguageServer.jl