Configure Mermaid for a native look

This commit is contained in:
Andrew Stryker
2026-03-30 16:47:08 -07:00
parent f10ca11257
commit ee5b9f7bcb
2 changed files with 30 additions and 4 deletions

View File

@@ -5,10 +5,7 @@
<!-- Mermaid diagrams -->
{{ if .Params.xparams.mermaid }}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11.13.0/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
</script>
{{ partialCached "mermaid.html" . }}
{{ end }}
<!-- React components -->

View File

@@ -0,0 +1,29 @@
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid@11.13.0/dist/mermaid.esm.min.mjs';
// Read PaperMod's CSS variables to theme Mermaid
const s = getComputedStyle(document.documentElement);
const v = (name) => s.getPropertyValue(name).trim();
mermaid.initialize({
startOnLoad: true,
theme: 'base',
flowchart: {
padding: 15,
nodeSpacing: 30,
useMaxWidth: true,
htmlLabels: true,
},
themeVariables: {
primaryColor: v('--code-bg'),
primaryTextColor: v('--content'),
primaryBorderColor: v('--border'),
lineColor: v('--secondary'),
secondaryColor: v('--code-bg'),
tertiaryColor: v('--theme'),
// these are PaperMod's defaults
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif',
fontSize: '14px',
}
});
</script>