Svgbob plugin for mdbook

Crate current version badge

Svgbob-based preprocessor for mdbook transform your ascii diagrams into a svg.

Usage

Prerequisites

Installation

Get latest release:

bash cargo install mdbook-svgbob

Or install from the git mirror:

bash cargo install --git https://github.com/fzzr-/mdbook-svgbob.git

If you want to contribute I recommend to get sources from pj repo:

```bash

install pijul if needed

cargo install pijul pijul clone nest.pijul.com:fzzr/mdbook-svgbob cargo install --path mdbook-svgbob ```

Integration

Add the preprocessor into your book manifest:

```toml

book.toml

[preprocessor.svgbob] textwidth = 8.0 textheight = 16.0 class = "bob" fontfamily = "arial" fontsize = 14.0 stroke_width = 2.0

there's using css-variables from theme:

strokecolor = "var(--fg)" # see default theme / variables.css backgroundcolor = "transparent" # also useful var(--bg)

all properties are optional.

```

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.

Contribution

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:

  1. add command to the manifest:

```toml

book.toml

[preprocessor.svgbob] command = "cargo run --manifest-path /path/to/mdbook-svgbob/Cargo.toml --quiet" ```

  1. So then you only need to rebuild the book. Run something like this:

bash RUST_LOG=mdbook_svgbob=trace mdbook build