From 554ae35e6fc49714de8a6960276b76810db6ce78 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Thu, 4 Nov 2021 10:06:52 +1100 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Add=20katex=20shortcode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- layouts/partials/vendor.html | 76 +++++++++++++++++++++-------------- layouts/shortcodes/katex.html | 1 + 2 files changed, 47 insertions(+), 30 deletions(-) create mode 100644 layouts/shortcodes/katex.html diff --git a/layouts/partials/vendor.html b/layouts/partials/vendor.html index 52ce1df3..1932f8b2 100644 --- a/layouts/partials/vendor.html +++ b/layouts/partials/vendor.html @@ -1,39 +1,55 @@ {{/* Mermaid */}} {{ if .Page.HasShortcode "mermaid" }} {{ $mermaidJS := resources.Get "vendor/mermaid/mermaid.min.js" }} - {{ if $mermaidJS }} - {{ $mermaidJS := $mermaidJS | resources.Fingerprint "sha512" }} - - {{ end }} + {{ $mermaidJS := $mermaidJS | resources.Fingerprint "sha512" }} + {{ end }} {{/* Chart */}} {{ if .Page.HasShortcode "chart" }} {{ $chartJS := resources.Get "vendor/chart/chart.min.js" }} - {{ if $chartJS }} - {{ $chartJS := $chartJS | resources.Fingerprint "sha512" }} - - + {{ $chartJS := $chartJS | resources.Fingerprint "sha512" }} + + +{{ end }} +{{/* Katex */}} +{{ if .Page.HasShortcode "katex" }} + {{ $katexCSS := resources.Get "vendor/katex/katex.min.css" }} + {{ $katexCSS := $katexCSS | resources.Fingerprint "sha512" }} + + {{ $katexJS := resources.Get "vendor/katex/katex.min.js" }} + {{ $katexJS := $katexJS | resources.Fingerprint "sha512" }} + + {{ $katexRenderJS := resources.Get "vendor/katex/auto-render.min.js" }} + {{ $katexRenderJS := $katexRenderJS | resources.Fingerprint "sha512" }} + + {{ $katexFonts := resources.Match "vendor/katex/fonts/*" }} + {{ range $katexFonts }} + {{ end }} {{ end }} diff --git a/layouts/shortcodes/katex.html b/layouts/shortcodes/katex.html new file mode 100644 index 00000000..a4160bfb --- /dev/null +++ b/layouts/shortcodes/katex.html @@ -0,0 +1 @@ +{{/* Nothing to see here */}}