Skip to content

Commit

Permalink
chore: cleanup mermaid logic
Browse files Browse the repository at this point in the history
  • Loading branch information
akashchandwani committed Feb 13, 2024
1 parent 528884d commit 5449d15
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 18 deletions.
19 changes: 1 addition & 18 deletions layouts/_default/single.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,25 +41,8 @@ <h1 class="post-title entry-hint-parent">
{{- else }}{{ .Content }}{{ end }}
</div>
{{- end }}
{{ if .Page.Store.Get "hasMermaid" }}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
const config = {
startOnLoad: true,
securityLevel: 'loose',
theme: localStorage.getItem("pref-theme") === "light" ? "light": "dark",
sankey: {
height: 400,
width: 600,
useMaxWidth: true,
linkColor: 'gradient',
nodeAlignment: 'justify',
},
};
mermaid.initialize(config);
</script>
{{ end }}

{{ partial "mermaid" . }}

<footer class="post-footer">
{{- $tags := .Language.Params.Taxonomies.tag | default "tags" }}
Expand Down
18 changes: 18 additions & 0 deletions layouts/partials/mermaid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{{ if .Page.Store.Get "hasMermaid" }}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
const config = {
startOnLoad: true,
securityLevel: 'loose',
theme: localStorage.getItem("pref-theme") === "light" ? "light": "dark",
sankey: {
height: 400,
width: 600,
useMaxWidth: true,
linkColor: 'gradient',
nodeAlignment: 'justify',
},
};
mermaid.initialize(config);
</script>
{{ end }}

0 comments on commit 5449d15

Please sign in to comment.