2021-11-03 05:52:40 +00:00
|
|
|
{{/* Mermaid */}}
|
|
|
|
{{ if .Page.HasShortcode "mermaid" }}
|
2021-11-04 03:19:02 +00:00
|
|
|
{{ $mermaidJS := resources.Get "lib/mermaid/mermaid.min.js" }}
|
|
|
|
{{ $mermaidJS := $mermaidJS | resources.Fingerprint "sha512" }}
|
|
|
|
<script defer src="{{ $mermaidJS.RelPermalink }}" integrity="{{ $mermaidJS.Data.Integrity }}"></script>
|
2021-11-03 23:06:52 +00:00
|
|
|
<script>
|
|
|
|
document.addEventListener('DOMContentLoaded', (event) => {
|
|
|
|
function css(name) {
|
|
|
|
return getComputedStyle(document.documentElement).getPropertyValue(name);
|
|
|
|
}
|
|
|
|
mermaid.initialize({ theme: "base", themeVariables: { background: css("--color-neutral"), primaryColor: css("--color-primary-200"), secondaryColor: css("--color-secondary-200"), tertiaryColor: css("--color-neutral-100"), primaryBorderColor: css("--color-primary-400"), secondaryBorderColor: css("--color-secondary-400"), tertiaryBorderColor: css("--color-neutral-400"), lineColor: css("--color-neutral-600"), fontFamily: "ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,noto sans,sans-serif", fontSize: "16px" }});
|
|
|
|
});
|
|
|
|
</script>
|
2021-11-03 05:52:40 +00:00
|
|
|
{{ end }}
|
|
|
|
{{/* Chart */}}
|
|
|
|
{{ if .Page.HasShortcode "chart" }}
|
2021-11-04 03:19:02 +00:00
|
|
|
{{ $chartJS := resources.Get "lib/chart/chart.min.js" }}
|
2021-11-03 23:06:52 +00:00
|
|
|
{{ $chartJS := $chartJS | resources.Fingerprint "sha512" }}
|
|
|
|
<script defer src="{{ $chartJS.RelPermalink }}" integrity="{{ $chartJS.Data.Integrity }}"></script>
|
|
|
|
<script>
|
|
|
|
document.addEventListener('DOMContentLoaded', (event) => {
|
|
|
|
function css(name) {
|
|
|
|
return getComputedStyle(document.documentElement).getPropertyValue(name);
|
|
|
|
}
|
|
|
|
Chart.defaults.font.size = 14;
|
|
|
|
Chart.defaults.backgroundColor = css("--color-primary-300");
|
|
|
|
Chart.defaults.elements.point.borderColor = css("--color-primary-400");
|
|
|
|
Chart.defaults.elements.bar.borderColor = css("--color-primary-500");
|
|
|
|
Chart.defaults.elements.bar.borderWidth = 1;
|
|
|
|
Chart.defaults.elements.line.borderColor = css("--color-primary-400");
|
|
|
|
Chart.defaults.elements.arc.backgroundColor = css("--color-primary-200");
|
|
|
|
Chart.defaults.elements.arc.borderColor = css("--color-primary-500");
|
|
|
|
Chart.defaults.elements.arc.borderWidth = 1;
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
{{ end }}
|
|
|
|
{{/* Katex */}}
|
|
|
|
{{ if .Page.HasShortcode "katex" }}
|
2021-11-04 03:19:02 +00:00
|
|
|
{{ $katexCSS := resources.Get "lib/katex/katex.min.css" }}
|
2021-11-03 23:06:52 +00:00
|
|
|
{{ $katexCSS := $katexCSS | resources.Fingerprint "sha512" }}
|
|
|
|
<link
|
|
|
|
type="text/css" rel="stylesheet"
|
|
|
|
href="{{ $katexCSS.RelPermalink }}"
|
|
|
|
integrity="{{ $katexCSS.Data.Integrity }}"
|
|
|
|
/>
|
2021-11-04 03:19:02 +00:00
|
|
|
{{ $katexJS := resources.Get "lib/katex/katex.min.js" }}
|
2021-11-03 23:06:52 +00:00
|
|
|
{{ $katexJS := $katexJS | resources.Fingerprint "sha512" }}
|
|
|
|
<script defer src="{{ $katexJS.RelPermalink }}" integrity="{{ $katexJS.Data.Integrity }}"></script>
|
2021-11-04 03:19:02 +00:00
|
|
|
{{ $katexRenderJS := resources.Get "lib/katex/auto-render.min.js" }}
|
2021-11-03 23:06:52 +00:00
|
|
|
{{ $katexRenderJS := $katexRenderJS | resources.Fingerprint "sha512" }}
|
|
|
|
<script defer src="{{ $katexRenderJS.RelPermalink }}" integrity="{{ $katexRenderJS.Data.Integrity }}" onload="renderMathInElement(document.body);"></script>
|
2021-11-04 03:19:02 +00:00
|
|
|
{{ $katexFonts := resources.Match "lib/katex/fonts/*" }}
|
2021-11-03 23:06:52 +00:00
|
|
|
{{ range $katexFonts }}
|
|
|
|
<!-- {{ .RelPermalink }} -->
|
2021-11-03 05:52:40 +00:00
|
|
|
{{ end }}
|
|
|
|
{{ end }}
|