This plugin adds the Mermaid JS library to Discourse so that posts can make use of its features. It turns this:
[mermaid]
gantt
title A Gantt Diagram
dateFormat YYYY-MM-DD
section Section
A task :a1, 2014-01-01, 30d
Another task :after a1 , 20d
section Another
Task in sec :2014-01-12 , 12d
another task : 24d
[/mermaid]
Iād love to, especially because Iām suspicious that might make the rendering more reliable. However, I canāt see how this happens, can you point me to something more specific?
Thanks @j.jaffeux ! As you saw, I merged in your PR and the results are far superior. The charts now load reliably and nearly instantly. Iāve updated the OP along these lines.
Really love this plugin, it is very fun to use when you get instant updates in the editor preview pane
Is there an easy way to make the plugin work better with dark themes?
Iāll add one more thing to my wishlist, it would be great to have a composer button for Mermaid that could insert some example charts and have a link to the documentation site to make it easier for new users to discover all the functionality of the script.
I started looking for a generic toolbar customizer plugin to insert the snippets I need but it doesnāt look like anyone has made one. It would probably make more sense for each plugin to manage their own toolbar extensions anyway.
I totally agree, the instant updates in the preview pane are awesome!
I see how it doesnāt look great with the Dark theme . Unfortunately, I donāt have the know how or capacity to work on a fix for that. However, I would gladly accept a PR that introduces a solution.
Mermaid has a few themes in their repo, which I imagine youād be able to select either with a site setting or something. My wild guess would be that this turns into
mermaid.init({ theme: 'dark' }, $mermaid)
Unfortunately none of the current ones (options are ādarkā, āforestā, and āneutralā) really look good with DIscourseās dark theme (they all have black text labels), so my recommendation here for someone willing to work on this (not me sorry )
In flow chart, some text does not display in right format
Speacially when you need in `` for format:
"`The **cat** in the hat`"
Everything just ok at mermaid.live
This is test for this sample:
flowchart LR
subgraph "One"
a("`The **cat**
in the hat`") -- "edge label" --> b{{"`The **dog** in the hog`"}}
end
subgraph "`**Two**`"
c("`The **cat**
in the hat`") -- "`Bold **edge label**`" --> d("The dog in the hog")
end
We have the theme component Discourse Mermaid here on Meta rather than the plugin, and I can see a similar result using the example:
flowchart LR
subgraph "One"
a("`The **cat**
in the hat`") -- "edge label" --> b{{"`The **dog** in the hog`"}}
end
subgraph "`**Two**`"
c("`The **cat**
in the hat`") -- "`Bold **edge label**`" --> d("The dog in the hog")
end
Iām not following the linked example though, as that doesnāt appear to show the bold/italic text in the finished flowchart: (though doesnāt show the Markdown itself)