Compatible with DokuWiki
This plugin provides support for the diagramming tool Mermaid. Mermaid is a JavaScript based diagramming and charting tool that renders Markdown-inspired text definitions to create and modify diagrams dynamically.
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Provide the Mermaid code enclosed by the <mermaid>
tags:
<mermaid> graph TD A(**mermaid**)-->B((__plugin__)) A-->C(((//for//))) B-->D[["[[https://www.dokuwiki.org/dokuwiki|Dokuwiki]]"]] C-->D </mermaid>
results in
Mermaid supports multiple other diagrams besides the shown flowchart, for example:
For full information, see https://mermaid.js.org/intro/.
The full syntax is
<mermaid #width #height> #Content </mermaid>
#Content
specifies the code that gets passed on to Mermaid for rendering. #Width
and #Height
are optional parameters and are used to specify the size of the container of the diagram. They can take any value supported by CSS, for example <mermaid 100% 1cm>
. Default value is auto
.
For more examples and details on the syntax, see https://mermaid.js.org/intro/.
If needed, the Mermaid code can be passed on without any processing or rendering by DokuWiki. Insert a line containing only the word raw before the Mermaid code:
<mermaid> raw graph TD A(**mermaid**)-->B((__plugin__)) A-->C(((//for//))) B-->D[["[[https://www.dokuwiki.org/dokuwiki|Dokuwiki]]"]] C-->D </mermaid>
This allows to use the full feature set of Mermaid without interference from DokuWiki, albeit at the expanse of not being able to use any functionality provided by DokuWiki.
No further configuration is required.
You can choose which Mermaid version you want to use:
You can choose which Mermaid theme should be used as a default. The available themes are the five integrated themes of Mermaid.
The syntax of Mermaid and DokuWiki can clash in rare cases. If you encounter problems, feel free to report them and open an issue.
You can sidestep these problems by using the raw mode which disables the processing by DokuWiki, or adjust your Mermaid code as shown below.
Mermaid and DokuWiki both use brackets. If you need to use them both at the same time, make your intentions clear by using quotation marks like:
["[[link]]"]
Mermaid supports the binding of click events. This can and will clash with DokuWikis own handling of links. Instead of:
<mermaid> flowchart TD A[Link] click A "https://www.github.com" </mermaid>
please use
<mermaid> flowchart TD A["[[https://www.github.com|Link]]"] </mermaid>
The search highlight of the DokuWiki search can prevent the proper parsing of the diagram, leading to an error. For that reason, it is disabled for the Mermaid diagrams. The search itself is not affected.
In the file action.php
, change the logLevel
of Mermaid to debug
for easier debugging by setting MERMAIDLOGLEVEL
to debug
.
This project is licensed under the GNU General Public License v2.0, included as LICENSE.
Mermaid is licensed under the MIT License, included as LICENSE Mermaid.