summaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorJan-Erik Rediger <janerik@fnordig.de>2018-07-20 12:02:12 +0200
committerJan-Erik Rediger <janerik@fnordig.de>2018-07-20 12:02:20 +0200
commit95377fd9b247763fe1e9568190f3ddbe094afbe1 (patch)
treeee2aaafca84fffcfdf3d96fa5e91d6eb481ae492 /README.md
parenta0de245557ca2bb9b3f61a4bf41256495dcb3aae (diff)
Add license and readme
Diffstat (limited to 'README.md')
-rw-r--r--README.md88
1 files changed, 88 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..cdd5742
--- /dev/null
+++ b/README.md
@@ -0,0 +1,88 @@
+# mdbook-mermaid
+
+A preprocessor for [mdbook][] to add [mermaid.js][] support.
+
+[mdbook]: https://github.com/rust-lang-nursery/mdBook
+[mermaid.js]: https://mermaidjs.github.io/
+
+It turns this:
+
+~~~
+```mermaid
+graph TD;
+ A-->B;
+ A-->C;
+ B-->D;
+ C-->D;
+```
+~~~
+
+into this:
+
+![Simple Graph](simple-graph.png)
+
+in your book.
+(Graph provided by [Mermaid Live Editor](https://mermaidjs.github.io/mermaid-live-editor/#/view/eyJjb2RlIjoiZ3JhcGggVEQ7XG4gICAgQS0tPkI7XG4gICAgQS0tPkM7XG4gICAgQi0tPkQ7XG4gICAgQy0tPkQ7IiwibWVybWFpZCI6eyJ0aGVtZSI6ImRlZmF1bHQifX0))
+
+## Installation
+
+If you want to use only this preprocessor, install the tool:
+
+```
+cargo install --git https://github.com/badboy/mdbook-mermaid
+```
+
+Add the following to your `book.toml`
+
+```toml
+[output.html]
+additional-css = ["mermaid.css"]
+additional-js = ["mermaid.min.js", "mermaid-init.js"]
+```
+
+Copy the files (`mermaid.css`, `mermaid.min.js`, `mermaid-init.js`) from the [`assets/`] (assets) directory into your source directory.
+
+Finally, build your book:
+
+```
+mdbook-mermaid path/to/book
+```
+
+### Programmatic use
+
+You can also use this programmatically, e.g. in order to use multiple additional preprocessors.
+Add `mdbook-mermaid` as a dependency in your `Cargo.toml`:
+
+```toml
+[dependencies.mdbook-mermaid]
+git = "https://github.com/badboy/mdbook-mermaid"
+```
+
+Then add it to your code:
+
+```rust
+extern crate mdbook_mermaid;
+
+// ...
+
+let mut book = MDBook::load(&book_dir)?;
+book.with_preprecessor(mdbook_mermaid::Mermaid);
+```
+
+Don't forget to copy the files (`mermaid.css`, `mermaid.min.js`, `mermaid-init.js`) from the [`assets/`] (assets) directory into your source directory.
+
+Add the following to your `book.toml` to include these files in your build:
+
+```toml
+[output.html]
+additional-css = ["mermaid.css"]
+additional-js = ["mermaid.min.js", "mermaid-init.js"]
+```
+
+
+
+
+## License
+
+MPL. See [LICENSE](LICENSE).
+Copyright (c) 2018 Jan-Erik Rediger <janerik@fnordig.de>