Skip to content

Commit

Permalink
Revert "UG LaTeX: typesetting of formulae using standard syntax (#1858)…
Browse files Browse the repository at this point in the history
…" (#2190)
  • Loading branch information
chalin authored Feb 10, 2025
1 parent 9815271 commit bf5e26c
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 211 deletions.
35 changes: 31 additions & 4 deletions layouts/partials/scripts.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
{{ $needKaTeX := or .Params.math .Site.Params.katex.enable .Params.chem .Site.Params.chem (.Page.Store.Get "hasKaTeX") (.Page.Store.Get "hasmhchem") -}}
{{ $needmhchem := or .Params.chem .Site.Params.katex.mhchem.enable (.Page.Store.Get "hasmhchem") -}}
{{ $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 -}}
<style>
Expand All @@ -26,8 +34,27 @@
<script src='{{ "js/deflate.js" | relURL }}'></script>
{{ end -}}

{{ if $needKaTeX -}}
{{ partial "scripts/katex.html" (dict "mhchem" $needmhchem) -}}
{{ if $needKaTeX -}}
{{/* load stylesheet and scripts for KaTeX support */ -}}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.css"
integrity="sha512-6a/jH+OTfV56Vs9Mm+Kl7ZsXWJRM2+EV+JDrW7HLHaf4OU2+9eLkHKFbzpSSbfJ5b60m+7/tQAevrzu7NP7Q2g==" crossorigin="anonymous">
{{/* The loading of KaTeX is deferred to speed up page rendering */ -}}
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/katex.min.js"
integrity="sha512-FkmlbBiAj8fgfoZ8zJ+bZQCU5pdU55irXmJzFF/mXlSvBr2x/gmyLHaRu5iSpcA5Hw6CMLCCFSjB1GmgtNL2Qg=="
crossorigin="anonymous">
</script>
{{ if $needmhchem -}}
{{/* To add support for displaying chemical equations and physical units, load the mhchem extension: */ -}}
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/mhchem.min.js"
integrity="sha512-Cl4bz7Rt9ppgcBOQa4z96q3UqAzHgBzNDm66u2+lDe0ZJQu0Fgz+6jO57E+IZqzlhGzfNBY++pg7Ue+iopaLrg=="
crossorigin="anonymous">
</script>
{{ end -}}
{{/* To automatically render math in text elements, include the auto-render extension: */ -}}
<script defer src="https://cdn.jsdelivr.net/npm/[email protected]/dist/contrib/auto-render.min.js"
integrity="sha512-6bKDPShiPRjAcdeO8T6cedaVEi0pavPbzue/G/ZRiwVlurWZOSZ/vI9fr2lhk8IPXK7z51AZac+zBvZzgDJzDQ==" crossorigin="anonymous"
{{ printf "onload='renderMathInElement(%s, %s);'" (( $.Page.Site.Params.katex.html_dom_element | default "document.body" ) | safeJS ) ( printf "%s" ( $.Page.Site.Params.katex.options | jsonify )) | safeHTMLAttr }}>
</script>
{{ end -}}

{{ $jsBs := resources.Get "vendor/bootstrap/dist/js/bootstrap.bundle.js" -}}
Expand Down
48 changes: 0 additions & 48 deletions layouts/partials/scripts/katex.html

This file was deleted.

12 changes: 0 additions & 12 deletions layouts/partials/scripts/mhchem.html

This file was deleted.

Loading

0 comments on commit bf5e26c

Please sign in to comment.