diff --git a/hugo.toml.example b/hugo.toml.example index f0676f1..2c24abd 100644 --- a/hugo.toml.example +++ b/hugo.toml.example @@ -122,6 +122,8 @@ expiryDate = ["expiryDate"] # siteNoIndex = false # noIndexPages = ["404 Page not found"] # usesAnimation = true + # mathjaxLib = "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" + # mermaidLib = "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs" [[params.socialLinks]] name = "mastodon" diff --git a/layouts/partials/footer.html b/layouts/partials/footer.html index 2ee0866..a188fd5 100644 --- a/layouts/partials/footer.html +++ b/layouts/partials/footer.html @@ -13,5 +13,5 @@ · Made with Hugo · Theme Hermit-V2 {{- end -}} - {{- with .OutputFormats.Get "RSS" }}· {{- partial "svg.html" (dict "context" . "name" "rss") -}}{{- end -}} + {{- with .OutputFormats.Get "RSS" }}· {{- partial "svg.html" (dict "context" . "name" "rss") -}}{{- end -}}

\ No newline at end of file diff --git a/layouts/partials/mathjax.html b/layouts/partials/mathjax.html index 503933b..4d6cd00 100644 --- a/layouts/partials/mathjax.html +++ b/layouts/partials/mathjax.html @@ -1,6 +1,15 @@ {{ if or (.Site.Params.global_mathjax) (.Params.mathjax) }} - -{{ $mathjaxa := resources.Get "js/mathjax-assistant.js"}} -{{ $mathjaxscript := slice $mathjaxa | resources.Concat "js/mathjaxs.js" | minify | fingerprint -}} - +{{- with $mathjaxLib := $.Site.Params.mathjaxLib | default "https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml.js" -}} +{{- if not (or (findRE `http[s]{0,1}://` $mathjaxLib 1) (findRE `^\/.*` $mathjaxLib 1)) -}} +{{ $mj := resources.Get $mathjaxLib }} + +{{- else if findRE `^\/.*` $mathjaxLib 1 -}} +{{ $mj := printf "%s%s" $.Site.BaseURL (strings.TrimLeft "/" $mathjaxLib) }} + +{{- else -}} + +{{- end -}} +{{- end -}} +{{ $mathjaxa := resources.Get "js/mathjax-assistant.js" | minify | fingerprint }} + {{ end }} \ No newline at end of file diff --git a/layouts/partials/mermaid.html b/layouts/partials/mermaid.html index 2208d0a..e2e0d5c 100644 --- a/layouts/partials/mermaid.html +++ b/layouts/partials/mermaid.html @@ -1,6 +1,23 @@ {{- if .Page.Store.Get "hasMermaid" -}} - + {{- $mermaid_initialize := `startOnLoad: true,theme: 'dark'` -}} + {{- with $mermaidLib := $.Site.Params.mermaidLib | default "https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs" -}} + {{- if not (or (findRE `http[s]{0,1}://` $mermaidLib 1) (findRE `^\/.*` $mermaidLib 1)) -}} + {{ $mm := resources.Get $mermaidLib }} + + {{- else if findRE `^\/.*` $mermaidLib 1 -}} + {{ $mm := printf "%s%s" $.Site.BaseURL (strings.TrimLeft "/" $mermaidLib) }} + + {{- else -}} + + {{- end -}} + {{- end -}} {{- end -}} \ No newline at end of file diff --git a/theme.toml b/theme.toml index ae402d4..f7f8add 100644 --- a/theme.toml +++ b/theme.toml @@ -17,7 +17,7 @@ features = [ [module] [module.hugoVersion] extended = true - min = '0.140' + min = '0.140.0' [author]