From bc9557e431b58af36baf76aa011a51f16a0832cd Mon Sep 17 00:00:00 2001
From: Lars Kellogg-Stedman instead of
+ // highlighted code, which is the markup mermaid.js looks for in the
+ // browser to replace with an inline SVG diagram.
+ const defaultFenceRenderer = markdownLibrary.renderer.rules.fence.bind(
+ markdownLibrary.renderer.rules,
+ );
+ markdownLibrary.renderer.rules.fence = (tokens, idx, options, env, self) => {
+ const token = tokens[idx];
+ if (token.info.trim() === "mermaid") {
+ return `${markdownLibrary.utils.escapeHtml(token.content)}\n`;
+ }
+ return defaultFenceRenderer(tokens, idx, options, env, self);
+ };
+
// Builds a collapsed, non-printing table of contents from the h2-h4
// headings (and their anchor ids, added by markdown-it-anchor above)
// found in a page's rendered content.
diff --git a/_assets/style.css b/_assets/style.css
index d8ccfe9..3bb01ed 100644
--- a/_assets/style.css
+++ b/_assets/style.css
@@ -209,6 +209,12 @@ pre {
margin-bottom: 0;
}
+pre.mermaid[data-processed] {
+ background-color: transparent;
+ padding: 0;
+ text-align: center;
+}
+
@media print {
nav,
.noprint {
diff --git a/_includes/layout.html b/_includes/layout.html
index bd6f19c..0776283 100644
--- a/_includes/layout.html
+++ b/_includes/layout.html
@@ -51,5 +51,9 @@