cargo install mdbook-graphviz
Install Graphviz
brew install graphviz
book.toml
toml
[preprocessor.graphviz]
command = "mdbook-graphviz"
output-to-file = false # defaults to false, change to true to create SVG files instead of rendering them inline
Just dot
is supported, but any of the other graphviz tools would be easy to add.
dot
Code Block For Processing~~~markdown
dot process
digraph {
"processed" -> "graph"
}
~~~
~~~markdown
~~~
dot
Code Blocks Without The process
Flag Are Ignored~~~markdown
dot
digraph {
"processed" -> "graph"
}
~~~
~~~markdown
dot
digraph {
"processed" -> "graph"
}
~~~
The default is to embed the SVG as HTML in the Markdown, however if this causes problems or if the actual files are
needed you can disable this via the output-to-file
flag:
toml
[preprocessor.graphviz]
output-to-file = true
or
shell
MDBOOK_preprocessor__graphviz__output_to_file="true" mdbook build
This .gitignore
should cover the generated SVG files.
*.generated.svg