#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

#517 in Text processing

Download history 759/week @ 2023-12-22 917/week @ 2023-12-29 1330/week @ 2024-01-05 1335/week @ 2024-01-12 1097/week @ 2024-01-19 1023/week @ 2024-01-26 1229/week @ 2024-02-02 1128/week @ 2024-02-09 1380/week @ 2024-02-16 1553/week @ 2024-02-23 1580/week @ 2024-03-01 2491/week @ 2024-03-08 1770/week @ 2024-03-15 1993/week @ 2024-03-22 958/week @ 2024-03-29 903/week @ 2024-04-05

6,335 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–27MB
~382K SLoC