~ / blog / Drawing in ASCII

       

  pandoc

       

  1 minute(s)

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:

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

This is what it would look like when the above ascii image is rendered on this blog:

1y122y1y2y133y3y23