A preprocessor for mdBook to convert svgdx fenced code blocks into inline SVG images.
For now installation requires a working Rust toolchain, e.g. installed from rustup.rs.
Install mdbook-svgdx as follows:
cargo install mdbook-svgdx
Your mdbook source must be configured to use the mdbook-svgdx preprocessor.
To do this, simply add the following line to your book.toml file.
[preprocessor.svgdx]By default mdbook-svgdx uses its built-in svgdx library support. When
MDBOOK_SVGDX_BIN is set in the environment, mdbook-svgdx invokes that
binary as a subprocess instead. When it is not set, the preprocessor falls back
to the built-in library if that feature is included in the build.
This crate provides a builtin-svgdx default feature that includes the svgdx
library internally and uses that for rendering. The alternative (with
--no-default-features) is to require MDBOOK_SVGDX_BIN and use a subprocess
in all cases. This provides a leaner mdbook-svgdx binary, but requires that
svgdx is installed locally and requires environment configuration, but
potentially avoids needing to update the preprocessor itself with each
svgdx change.
To test changes to mdbook-svgdx, update your book.toml with the following 'command' line under the preprocessor.svgdx block:
[preprocessor.svgdx]
command = "cargo run --manifest-path /path/to/mdbook-svgdx/Cargo.toml --quiet"To test changes to the svgdx binary itself, point mdbook-svgdx at an external
svgdx executable via MDBOOK_SVGDX_BIN instead of modifying this repository's
dependency graph. For example:
export MDBOOK_SVGDX_BIN=/path/to/svgdx/target/debug/svgdx
mdbook buildThis repository is released under the MIT license; for more information see the LICENSE file.