mdbook-svgbob 0.1.1

SvgBob mdbook preprocessor which swaps code-blocks with neat SVG.
mdbook-svgbob-0.1.1 is not a library.

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:

cargo install mdbook-svgbob

Or install from the git mirror:

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

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

# 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:

# book.toml

[preprocessor.svgbob]
text_width = 8.0
text_height = 16.0
class = "bob"
font_family = "arial"
font_size = 14.0
stroke_width = 2.0
# there's using css-variables from theme:
stroke_color = "var(--fg)" # see default theme / variables.css
background_color = "transparent" # also useful `var(--bg)`
# all properties are optional.

Then add code-block to some chapter:

<!-- chapter_1.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:
# 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:
RUST_LOG=mdbook_svgbob=trace mdbook build