| Crates.io | badascii |
| lib.rs | badascii |
| version | 0.2.0 |
| created_at | 2025-04-22 04:27:23.103218+00 |
| updated_at | 2025-04-23 04:18:53.733063+00 |
| description | Backend rendering library for BadASCII diagrams. Block diagrams in ASCII. |
| homepage | https://badascii.me |
| repository | https://github.com/samitbasu/badascii |
| max_upload_size | |
| id | 1643614 |
| size | 422,888 |
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
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.
There are many. The most sophisticated might be svgbob.