diagwiz -- ASCII diagrams as code
Warning: This project is in early experimental stage. Functionality is subject to change and YMMV. Feel free to open an issue if you have any suggestions, Rust tips & tricks (my first Rust project) or stumbled upon any bugs.
Supported diagrams
Installation
As the package is currently in experimental stage, you can install it by building it from the source or by downloading the pre-compiled binary from the latest nightly release.
Download a nightly binary
Visit the nightly release page and download a binary compatible with your system.
Install from source
cargo install --git https://github.com/kjagiello/diagwiz
Usage example
$ cat <<EOF > example.diag
alias ali = "Alice"
ali->Bob: "Hello!"
Bob->Bob: "(Bob thinks)"
Bob->ali: "Hello back!"
EOF
$ diagwiz < example.diag
┌───────┐ ┌─────┐
│ Alice │ │ Bob │
└───────┘ └─────┘
│ Hello! │
│──────────────▶│
│ │
│ │─┐
│ │ │ (Bob thinks)
│ │◀┘
│ │
│ Hello back! │
│◀──────────────│
│ │
┌───────┐ ┌─────┐
│ Alice │ │ Bob │
└───────┘ └─────┘
Known issues
- Characters with a column width other than 1 cause artifacts in the ASCII representation of a diagram
- For some inputs, the generated layout might change on every run. This is due to the Cassowary algorithm implementation not being deterministic and finding multiple optimal solutions for the given constraints.