Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boozook/mdbook-svgbob
SvgBob mdbook preprocessor which swaps code-blocks with neat SVG.
https://github.com/boozook/mdbook-svgbob
ascii-art markdown mdbook mdbook-plugins preprocessor svg svgbob
Last synced: about 1 month ago
JSON representation
SvgBob mdbook preprocessor which swaps code-blocks with neat SVG.
- Host: GitHub
- URL: https://github.com/boozook/mdbook-svgbob
- Owner: boozook
- License: mpl-2.0
- Created: 2020-04-11T09:57:00.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-09-07T12:07:01.000Z (4 months ago)
- Last Synced: 2024-10-07T18:49:01.098Z (3 months ago)
- Topics: ascii-art, markdown, mdbook, mdbook-plugins, preprocessor, svg, svgbob
- Language: Rust
- Size: 85 KB
- Stars: 76
- Watchers: 3
- Forks: 9
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Svgbob plugin for mdbook
[Svgbob][]-based preprocessor for [mdbook][] transform your ascii diagrams into a svg.
This renders a code-block marked `bob` into neat svg diagrams and inline it into the output.
## Usage
Firstly add the following to your book's manifest file
(usually `book.toml`)```toml
[preprocessor.svgbob] # all fields by default
```
See [config](#config) for more information.Add some ascii graphics:
_chapter_1.md_
````md
```bob
0 3
*-------* +y
1 /| 2 /| ^
*-------* | |
| |4 | |7 | ◄╮
| *-----|-* ⤹ +-----> +x
|/ |/ / ⤴
*-------* v
5 6 +z
```
````Build your book and open:
```
mdbook build
open book/index.html
```### Config
Default preprocessor config:
```toml
[preprocessor.svgbob]
# svgbob configuration:
# doc: https://docs.rs/svgbob/latest/svgbob/struct.Settings.html
# default values: https://github.com/ivanceras/svgbob/blob/master/packages/svgbob/src/settings.rs#L29-L38
font_size = 14
font_family = "Iosevka Fixed, monospace"
fill_color = "black"
background = "transparent" # default overridden, differs from svgbob's default
stroke_color = "var(--fg)" # default overridden, differs from svgbob's default
stroke_width = 2.0
scale = 8.0
enhance_circuitries = true
include_backdrop = true
include_styles = true
include_defs = true
merge_line_with_shapes = false# preprocessor configuration:
code_block = "bob" # render only code-blocks marked as "bob", e.g.: ```bob
```All properties are optional.
See [svgbob's settings doc](https://docs.rs/svgbob/latest/svgbob/struct.Settings.html) and [default values](https://github.com/ivanceras/svgbob/blob/master/packages/svgbob/src/settings.rs#L29-L38]).
- - -
For more information about mdbook see [mdbook manual][mdbook.manual],
[svgbob spec][svgbob.spec] and [editor][svgbob.editor].## Contribution
Contributions are appreciated.
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"
```2. So then you only need to rebuild the book. Run something like this:
```bash
RUST_LOG=mdbook_svgbob=trace mdbook build
```[Rust]: https://www.rust-lang.org
[Rustup]: https://rustup.rs[mdbook]: https://crates.io/crates/mdbook
[mdbook.manual]: https://rust-lang.github.io/mdBook/[Svgbob]: https://crates.io/crates/svgbob
[svgbob.spec]: https://ivanceras.github.io/#md/Svgbob/Specification.md
[svgbob.editor]: https://ivanceras.github.io/svgbob-editor/