#mdbook #mermaid #graph #add #book #js

bin+lib mdbook-mermaid

mdbook preprocessor to add mermaid support

31 releases

0.13.0 Dec 13, 2023
0.12.6 Dec 19, 2022
0.12.2 Nov 29, 2022
0.11.2 Jul 29, 2022
0.2.2 Jul 16, 2019

#652 in Text processing

Download history 2197/week @ 2024-03-14 2043/week @ 2024-03-21 1000/week @ 2024-03-28 1112/week @ 2024-04-04 1199/week @ 2024-04-11 1068/week @ 2024-04-18 1329/week @ 2024-04-25 1187/week @ 2024-05-02 1292/week @ 2024-05-09 1105/week @ 2024-05-16 1384/week @ 2024-05-23 1580/week @ 2024-05-30 1946/week @ 2024-06-06 2147/week @ 2024-06-13 2074/week @ 2024-06-20 1545/week @ 2024-06-27

7,906 downloads per month
Used in mdbook-dtmo

MPL-2.0 license

3MB
2K SLoC

JavaScript 1.5K SLoC // 0.0% comments Rust 483 SLoC

mdbook-mermaid

A preprocessor for mdbook to add mermaid.js support.

It turns this:

```mermaid
graph TD;
    A-->B;
    A-->C;
    B-->D;
    C-->D;
```

into this:

Simple Graph

in your book. (Graph provided by Mermaid Live Editor)

Installation

If you want to use only this preprocessor, install the tool:

cargo install mdbook-mermaid

Then let mdbook-mermaid add the required files and configuration:

mdbook-mermaid install path/to/your/book

This will add the following configuration to your book.toml:

[preprocessor.mermaid]
command = "mdbook-mermaid"

[output.html]
additional-js = ["mermaid.min.js", "mermaid-init.js"]

It will skip any unnecessary changes and detect if mdbook-mermaid was already configured.

Additionally it copies the files mermaid.min.js and mermaid-init.js into your book's directory. You find these files in the src/bin/assets directory. You can modify mermaid-init.js to configure Mermaid, see the Mermaid documentation for all options.

Finally, build your book:

mdbook path/to/book

License

MPL. See LICENSE.
Copyright (c) 2018-2021 Jan-Erik Rediger janerik@fnordig.de

Mermaid is MIT licensed. The bundled assets (mermaid.min.js) are MIT licensed.

Dependencies

~14–26MB
~373K SLoC