{{ $needKaTeX := or .Site.Params.katex.enable .Params.math .Params.chem -}}
{{ $needmhchem := or .Site.Params.katex.mhchem.enable .Params.chem -}}
{{ if ge hugo.Version "0.93.0" -}}
{{ $needKaTeX = or $needKaTeX (.Page.Store.Get "hasKaTeX") (.Page.Store.Get "hasmhchem") -}}
{{ $needmhchem = or $needmhchem (.Page.Store.Get "hasmhchem") -}}
{{ else -}}
{{ if or $needKaTeX $needmhchem -}}
{{ warnf "Outdated Hugo version %s, consider upgrading to make full use of all theme features" hugo.Version }}
{{ end -}}
{{ end -}}
{{ if .Site.Params.markmap.enable -}}
{{ end -}}
{{ if .Site.Params.plantuml.enable -}}
{{ end -}}
{{ if $needKaTeX -}}
{{/* load stylesheet and scripts for KaTeX support */ -}}
{{/* The loading of KaTeX is deferred to speed up page rendering */ -}}
{{ if $needmhchem -}}
{{/* To add support for displaying chemical equations and physical units, load the mhchem extension: */ -}}
{{ end -}}
{{/* To automatically render math in text elements, include the auto-render extension: */ -}}
{{ end -}}
{{ $jsBs := resources.Get "vendor/bootstrap/dist/js/bootstrap.bundle.js" -}}
{{ $jsBase := resources.Get "js/base.js" -}}
{{ $jsSearch := resources.Get "js/search.js" | resources.ExecuteAsTemplate "js/search.js" .Site.Home -}}
{{ $jsMarkmap := resources.Get "js/markmap.js" | resources.ExecuteAsTemplate "js/markmap.js" . -}}
{{ $jsPlantuml := resources.Get "js/plantuml.js" | resources.ExecuteAsTemplate "js/plantuml.js" . -}}
{{ $jsDrawio := resources.Get "js/drawio.js" | resources.ExecuteAsTemplate "js/drawio.js" . -}}
{{ if .Site.Params.offlineSearch -}}
{{ $jsSearch = resources.Get "js/offline-search.js" -}}
{{ end -}}
{{ $jsArray := slice $jsBs $jsBase $jsSearch $jsPlantuml $jsMarkmap $jsDrawio -}}
{{ if .Page.Store.Get "hasmermaid" -}}
{{- partial "scripts/mermaid.html" . -}}
{{ end -}}
{{ $js := $jsArray | resources.Concat "js/main.js" -}}
{{ if hugo.IsProduction -}}
{{ $js := $js | minify | fingerprint -}}
{{ else -}}
{{ end -}}
{{ if .Site.Params.prism_syntax_highlighting -}}
{{ else if ( not .Site.Params.disable_click2copy_chroma ) -}}
{{ $c2cJS := resources.Get "js/click-to-copy.js" -}}
{{ if hugo.IsProduction -}}
{{ $c2cJS = $c2cJS | minify | fingerprint -}}
{{ end -}}
{{ end -}}
{{ if and .Site.Params.search (isset .Site.Params.search "algolia") -}}
{{ template "algolia/scripts" .Site.Params.search.algolia -}}
{{ end -}}
{{ partial "hooks/body-end.html" . -}}
{{ define "algolia/scripts" -}}
{{ end -}}