Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/site.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
],
"plugins" : [
"filterTags",
"mathDelimiters"
"mathDelimiters",
"mermaid"
],
"pluginsContext" : {
"filterTags" : {
Expand Down
94 changes: 94 additions & 0 deletions docs/userGuide/plugins/mermaid.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
### Plugin: Mermaid

This plugin allows you to utilize <tooltip content="Mermaid lets you create diagrams and visualizations using text and code">Mermaid</tooltip> by automatically importing the library and initializing the rendering of the diagrams.

> Mermaid is a JavaScript based diagramming and charting tool that renders Markdown-inspired text definitions to create and modify diagrams dynamically.

<box type="info">

All supported diagrams and detailed configurations are available in [the mermaid official documentation](https://mermaid-js.github.io/mermaid/).

</box>

To enable this plugin, add `mermaid` to your site's plugins. Optionally, you can specify alternative URL (e.g. to use another CDN or another version) or
any custom configurations in the plugin context.

```js {heading="site.json"}
{
...
"plugins": [
"mermaid"
],
"pluginsContext" : {
"mermaid" : { // can be omitted if no changes to the following default settings are required
"address": "https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs", // replace with URL of your choice
"config": {
"startOnLoad": "true", // add or modify mermaid configurations
}
}
},
}
```

{{ icon_example }} Pie Chart:

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">
<mermaid>
pie title Pets adopted by volunteers
"Dogs" : 386
"Cats" : 85
"Rats" : 15
</mermaid>
</variable>
</include>

{{ icon_example }} Flowchart:

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">
<mermaid>
flowchart TD
A[Start] --> B{Is it?}
B -->|Yes| C[OK]
C --> D[Rethink]
D --> B
B ---->|No| E[End]
</mermaid>
</variable>
</include>

{{ icon_example }} User Journey Diagram:

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">
<mermaid>
journey
title My working day
section Go to work
Make tea: 5: Me
Go upstairs: 3: Me
Do work: 1: Me, Cat
</mermaid>
</variable>
</include>

{{ icon_example }} Gitgraph Diagram:

<include src="codeAndOutput.md" boilerplate >
<variable name="highlightStyle">html</variable>
<variable name="code">
<mermaid>
gitGraph
commit
branch develop
checkout develop
commit
checkout main
merge develop
</mermaid>
</variable>
</include>
5 changes: 5 additions & 0 deletions docs/userGuide/syntax/diagrams.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ name | `string` | The name of the output file.
src | `string` | The URL of the diagram if your diagram is in another `.puml` file.<br>The URL can be specified as absolute or relative references. More info in: _[Intra-Site Links]({{baseUrl}}/userGuide/formattingContents.html#intraSiteLinks)_
width | `string` | The width of the diagram in pixels.<br>If both width and height are specified, width takes priority over height. It is to maintain the diagram's aspect ratio.

<box type="tip">

It's also possible to utilize JavaScript diagram libraries such as [Mermaid](https://mermaid-js.github.io/mermaid/) via the [Mermaid plugin](../usingPlugins.html#plugin-mermaid).
</box>

<div id="short" class="d-none">

```
Expand Down
1 change: 1 addition & 0 deletions docs/userGuide/usingPlugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ MarkBind has a set of built-in plugins that can be used immediately without inst
<include src="plugins/googleAnalytics.md" />
<include src="plugins/disqus.md" />
<include src="plugins/mathDelimiters.md" />
<include src="plugins/mermaid.md" />

## Using External Plugins

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,5 +247,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
4 changes: 4 additions & 0 deletions packages/cli/test/functional/test_site/expected/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -820,5 +820,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
6 changes: 6 additions & 0 deletions packages/cli/test/functional/test_site/expected/siteData.json
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,12 @@
"title": "page nav with title added",
"headings": {},
"headingKeywords": {}
},
{
"src": "testMermaid.md",
"title": "Rendering of diagrams via mermaid-js",
"headings": {},
"headingKeywords": {}
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -246,5 +246,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -313,5 +313,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -300,5 +300,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -268,5 +268,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -436,5 +436,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -255,5 +255,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
4 changes: 4 additions & 0 deletions packages/cli/test/functional/test_site/expected/testHr.html
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -335,5 +335,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -250,5 +250,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -245,5 +245,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -251,5 +251,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Original file line number Diff line number Diff line change
Expand Up @@ -254,5 +254,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
4 changes: 4 additions & 0 deletions packages/cli/test/functional/test_site/expected/testMath.html
Original file line number Diff line number Diff line change
Expand Up @@ -510,5 +510,9 @@ <h1 id="heading-in-footer-should-not-be-indexed"><span id="heading-in-footer-sho

gtag('config', 'TRACKING-ID');
</script>
<script type="module">
import mermaid from 'https://unpkg.com/mermaid@9/dist/mermaid.esm.min.mjs';
mermaid.initialize({"startOnLoad":true,"theme":"forest"});
</script>

</html>
Loading