Skip to content

Commit c69baac

Browse files
committed
Merge pull request #136 from bollwyvl/patch-3
Add description of manual calling of init
2 parents c5f2740 + a6abb3c commit c69baac

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

docs/usage.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,26 @@ Would end up like this:
6262
```
6363
An id is also added to mermaid tags without id.
6464

65+
## Calling `mermaid.init`
66+
By default, `mermaid.init` will be called when the document is ready, finding all elements with
67+
`class="mermaid"`. If you are adding content after mermaid is loaded, or otherwise need
68+
finer-grained control of this behavior, you can call `init` yourself with:
69+
- a configuration object
70+
- some nodes, as
71+
- a node
72+
- an a array-like of nodes
73+
- or W3C selector that will find your nodes
74+
75+
Example:
76+
```
77+
mermaid.init({noteMargin: 10}, ".someOtherClass");
78+
```
79+
Or with no config object, and a jQuery selection:
80+
```
81+
mermaid.init(undefined, $("#someId .yetAnotherClass"));
82+
```
83+
84+
6585
# Example of marked renderer
6686

6787
This is the renderer used for transforming the documentation from markdown to html with mermaid diagrams in the html.

0 commit comments

Comments
 (0)