summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/behaviors/markdown/render_mermaid.js
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2019-06-25 07:03:52 -0700
committerStan Hu <stanhu@gmail.com>2019-06-25 21:57:04 -0700
commit21d8c8cac3c09672bc31e427dc1fb88e365d22d2 (patch)
tree027b52e367bea8a1513828ea2dd01b70a89f7dbf /app/assets/javascripts/behaviors/markdown/render_mermaid.js
parent76889a9956e76e300edc8993048c3cd5c3a24da0 (diff)
downloadgitlab-ce-21d8c8cac3c09672bc31e427dc1fb88e365d22d2.tar.gz
Update Mermaid to 8.1.0
This fixes dotted lines not rendering when the htmlLabels setting is false (https://github.com/knsv/mermaid/pull/828). Full list of changes: https://github.com/knsv/mermaid/releases Closes https://gitlab.com/gitlab-org/gitlab-ce/issues/60869
Diffstat (limited to 'app/assets/javascripts/behaviors/markdown/render_mermaid.js')
-rw-r--r--app/assets/javascripts/behaviors/markdown/render_mermaid.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/app/assets/javascripts/behaviors/markdown/render_mermaid.js b/app/assets/javascripts/behaviors/markdown/render_mermaid.js
index d0b7f3ff7a2..b23de36f860 100644
--- a/app/assets/javascripts/behaviors/markdown/render_mermaid.js
+++ b/app/assets/javascripts/behaviors/markdown/render_mermaid.js
@@ -59,6 +59,14 @@ export default function renderMermaid($els) {
mermaid.init(undefined, el, id => {
const svg = document.getElementById(id);
+ // As of https://github.com/knsv/mermaid/commit/57b780a0d,
+ // Mermaid will make two init callbacks:one to initialize the
+ // flow charts, and another to initialize the Gannt charts.
+ // Guard against an error caused by double initialization.
+ if (svg.classList.contains('mermaid')) {
+ return;
+ }
+
svg.classList.add('mermaid');
// pre > code > svg