Svgbob-based preprocessor for mdbook transform your ascii diagrams into a svg.
cargo install mdbook
Get latest release:
bash
cargo install mdbook-svgbob
Or install from repo:
bash
cargo install --git https://github.com/fzzr-/mdbook-svgbob.git
Add the preprocessor into your book manifest:
```toml
[preprocessor.svgbob] textwidth = 8.0 textheight = 16.0 class = "bob" fontfamily = "arial" fontsize = 14.0 stroke_width = 2.0
strokecolor = "var(--fg)" # see default theme / variables.css
backgroundcolor = "transparent" # also useful var(--bg)
```
Then add code-block to some chapter:
````md
bob
.------------>-----------------.
┌-------------┐ .-. .-. | ┌------┐ .-. ┌-----┐ | .-. ┌------┐
O-╮--| struct_name |-( : )-( | )-╰-╮-| name |-( : )--| tpe |--╮-╯---( | )--| body |--╭---O
| └-------------┘ `-' `-' | └------┘ `-' └-----┘ | `-' └------┘ |
| | .-. | |
| `------------<------( , )--' |
| `-' |
`----------------------------------------------------------------------------------'
````
That's all. ♥️
For more information about mdbook see mdbook manual, svgbob spec and editor.
Contributions are highly appreciated and encouraged! Don't hesitate to participate to discussions in the issues, propose new features and ask for help.
Useful hint for one-command builds crate + book:
command
to the manifest:```toml
[preprocessor.svgbob] command = "cargo run --manifest-path /path/to/mdbook-svgbob/Cargo.toml --quiet" ```
bash
RUST_LOG=mdbook_svgbob=trace mdbook build