ASCII Box

Render boxes and arrows diagrams from ASCII text.

License: GPLv3+
Version: 0.4.0

ASCII Box is a Python program which renders "boxes and arrows" diagrams from ASCII text blocks. Currently ASCII Box can render PNG and SVG images.

Rendering example

Input Output
     |
     |
     v
   +-+-+
   |   |
-->|Hi!+-->
   |   |
   +---+
     |
     |
     v

fig1.png

Dependencies

Both dependencies are available from PyPi.

Download and install

To get the source code, you can either clone the source code repository or fetch the source code release tarball from releases.

Then building and installing ASCII Box is just a matter of running:

python setup.py build
sudo python setup.py install

However, you need to ensure all dependencies are available as well.

Alternatively, you can install ASCII Box and all its dependencies from Python Package Index using pip:

pip install asciibox

Command line usage

To render a PNG file, run:

asciibox -i doc/examples/fig.txt -o fig.png

To render a SVG file, run:

asciibox -i doc/examples/fig.txt -o fig.svg

Use --help to display all available options.

reStructuredText markup extension

The module contains also a reStructuredText directive extension which can be registered with reStructuredText as follows:

import asciibox
asciibox.register_rst_directive()

Then the registered directive can be used as follows:

Input Output
.. asciibox:: fig5.svg

   Layers --+
            |
            v
  +--------------+
  |     Top      |
  +--------------+
  |   Middle     |
  |     +--------+
  |     | Bottom |
  +-----+--------+

fig5.svg

Comments

Comments powered by Disqus