3 unstable releases
Uses new Rust 2024
new 0.2.0 | Apr 23, 2025 |
---|---|
0.1.1 | Apr 22, 2025 |
0.1.0 | Apr 22, 2025 |
#568 in Text processing
130 downloads per month
Used in 2 crates
180KB
1.5K
SLoC
BADASCII
This crate provides a backend library for processing BADASCII strings. These strings represent simple block diagrams written using basic ASCII characters. Like this:
+-------------+ +-------------+
| Thing 1 | | Thing 2 |
| | | |
+--->|ins outs+------->|ins outs+----+
| | | | | |
| | | | | |
| +-------------+ +-------------+ |
| |
+----------------------------------------------+
and convert them into SVG images like this:
To use this as a library, the API is pretty simple:
use badascii::{RenderJob, TextBuffer};
// Create a text buffer from the string
let text_buffer = TextBuffer::with_text(" +---> ");
// Create a render job
let job = RenderJob::rough(text_buffer);
// Render it with a white text color
let svg = badascii::svg::render(&job, "white");
// Rejoice! `svg` contains a string with the SVG
Other stuff
You can use badascii
in your RustDoc generated comments
using the badascii-doc
crate. You can also edit badascii
diagrams using the GUI editor at badascii-gui
. And
eventually at the website I plan to set up. Last but not
least, there is a mdbook preprocessor at badascii-mdbook
.
Alternates
There are many. The most sophisticated might be svgbob
.
Dependencies
~11MB
~190K SLoC