8.1.0 • Published 7 years ago
gitbook-plugin-mermaid-gen v8.1.0
It's a fork on JozoVilcek/piranna's gitbook-plugin-mermaid
with the fix:
- works with Gitbook3(CLI version: 2.3.2, GitBook version: 3.2.3)
- latest version with mermaid 8
- update the version of phantom; export an method called
string2svg()
- generate svg at Compile, no external css/js required with css inlined.
- if error "TypeError ERR_INVALID_ARG_TYPE: The "file" argument must be of type string. Received type object", please run
npm rebuild
, see at phantomjs-prebuilt
Mermaid plugin for GitBook
Plugin for GitBook which renders Mermaid diagrams and flow charts detected in the book markdown.
How to install it?
You can use install via NPM:
$ npm install gitbook-plugin-mermaid-gen
And use it for your book with in the book.json:
{
"plugins": ["mermaid-gen"]
}
How to use it?
There are two options how can be graph put into the gitbook.
To use embedded graph, put in your book block as:
{% mermaid %}
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
{% endmermaid %}
Plugin will pick up block body and replace it with generated svg diagram.
Fork modification: From
gitbook-plugin-mermaid-gb3
, we learned support formermaid`
To load graph from file, put in your book block as:
{% mermaid src="./diagram.mermaid" %}
{% endmermaid %}
If not absolute, plugin will resolve path given in src
attribute relative to the current book page,
load its content and generate svg diagram.