D2 preprocessor for mdbook
A preprocessor for mdbook to convert
d2 codeblocks into SVG images using
D2.
Installation
Install with cargo:
Or to install from git:
Requirements
This preprocessor assumes that D2 is installed locally and on the path. D2 installation instructions can be found here.
Check that the local installation is working correctly using
Usage
Add this to your book.toml:
[]
# path to d2 binary.
# optional. default is "d2" (ie. on the path).
= "d2"
# layout engine for diagrams. See https://github.com/terrastruct/d2#plugins.
# optional. default is "dagre".
= "dagre"
# output directory relative to `src/` for generated diagrams.
# optional. default is "d2".
= "d2"
Thanks
The code in this preprocessor is based on that from https://github.com/matthiasbeyer/mdbook-svgbob2