Skip to content

Commit 70b52d0

Browse files
author
Laurent Franceschetti
committed
Fix documentation of arguments
1 parent 6d6aa1d commit 70b52d0

1 file changed

Lines changed: 51 additions & 11 deletions

File tree

webdoc/docs/description.md

Lines changed: 51 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -105,21 +105,61 @@ For example, you could change the theme of the diagram,
105105
using 'dark' instead of the default one.
106106
Simply add those arguments in the config file, e.g.
107107

108+
108109
```yaml
109110
plugins:
110-
- search
111-
- mermaid2:
112-
version: '10.1.0'
113-
arguments:
111+
- search
112+
- mermaid2:
113+
version: '10.1.0'
114+
arguments:
114115
theme: 'dark'
115116
themeVariables:
116-
primaryColor: '#BB2528'
117-
primaryTextColor: '#fff'
118-
primaryBorderColor: '#7C0000'
119-
lineColor: '#F8B229'
120-
secondaryColor: '#006100'
121-
tertiaryColor: '#fff'
117+
primaryColor: '#BB2528'
118+
primaryTextColor: '#fff'
119+
primaryBorderColor: '#7C0000'
120+
lineColor: '#F8B229'
121+
secondaryColor: '#006100'
122+
tertiaryColor: '#fff'
122123
```
123124

125+
The plugin then automatically adds the initialization sequence:
126+
127+
=== "mermaid.js >= 10.0"
128+
129+
Both `import` and `mermaid.initialize()` must be in the same `<script>`
130+
tag.
131+
132+
```html
133+
<script type="module">import mermaid from "https://unpkg.com/mermaid@10.1.0/dist/mermaid.esm.min.mjs";
134+
mermaid.initialize({
135+
theme: "dark",
136+
themeVariables: {
137+
primaryColor: "#BB2528",
138+
primaryTextColor: "#fff",
139+
primaryBorderColor: "#7C0000",
140+
lineColor: "#F8B229",
141+
secondaryColor: "#006100",
142+
tertiaryColor: "#fff"
143+
}
144+
});
145+
</script>
146+
```
147+
=== "Earlier versions"
124148

125-
=== "Earlier versions"
149+
For versions of mermaid.js < 10, **two** calls to the `<script>` tag are required.
150+
151+
```html
152+
<script src="https://unpkg.com/mermaid@9.1.0/dist/mermaid.min.js"></script>
153+
<script>mermaid.initialize({
154+
theme: "dark",
155+
themeVariables: {
156+
primaryColor: "#BB2528",
157+
primaryTextColor: "#fff",
158+
primaryBorderColor: "#7C0000",
159+
lineColor: "#F8B229",
160+
secondaryColor: "#006100",
161+
tertiaryColor: "#fff"
162+
}
163+
});
164+
</script>
165+
```

0 commit comments

Comments
 (0)