Skip to content

Commit 14ef12c

Browse files
committed
Revert "UG LaTeX: typesetting of formulae using standard syntax (google#1858)"
Used `git revert HEAD`: - This reverts commit 9815271. - For context, see google#2189
1 parent 9815271 commit 14ef12c

File tree

5 files changed

+83
-211
lines changed

5 files changed

+83
-211
lines changed

layouts/partials/scripts.html

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
1-
{{ $needKaTeX := or .Params.math .Site.Params.katex.enable .Params.chem .Site.Params.chem (.Page.Store.Get "hasKaTeX") (.Page.Store.Get "hasmhchem") -}}
2-
{{ $needmhchem := or .Params.chem .Site.Params.katex.mhchem.enable (.Page.Store.Get "hasmhchem") -}}
1+
{{ $needKaTeX := or .Site.Params.katex.enable .Params.math .Params.chem -}}
2+
{{ $needmhchem := or .Site.Params.katex.mhchem.enable .Params.chem -}}
3+
{{ if ge hugo.Version "0.93.0" -}}
4+
{{ $needKaTeX = or $needKaTeX (.Page.Store.Get "hasKaTeX") (.Page.Store.Get "hasmhchem") -}}
5+
{{ $needmhchem = or $needmhchem (.Page.Store.Get "hasmhchem") -}}
6+
{{ else -}}
7+
{{ if or $needKaTeX $needmhchem -}}
8+
{{ warnf "Outdated Hugo version %s, consider upgrading to make full use of all theme features" hugo.Version }}
9+
{{ end -}}
10+
{{ end -}}
311

412
{{ if .Site.Params.markmap.enable -}}
513
<style>
@@ -26,8 +34,27 @@
2634
<script src='{{ "js/deflate.js" | relURL }}'></script>
2735
{{ end -}}
2836

29-
{{ if $needKaTeX -}}
30-
{{ partial "scripts/katex.html" (dict "mhchem" $needmhchem) -}}
37+
{{ if $needKaTeX -}}
38+
{{/* load stylesheet and scripts for KaTeX support */ -}}
39+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.19/dist/katex.min.css"
40+
integrity="sha512-6a/jH+OTfV56Vs9Mm+Kl7ZsXWJRM2+EV+JDrW7HLHaf4OU2+9eLkHKFbzpSSbfJ5b60m+7/tQAevrzu7NP7Q2g==" crossorigin="anonymous">
41+
{{/* The loading of KaTeX is deferred to speed up page rendering */ -}}
42+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.19/dist/katex.min.js"
43+
integrity="sha512-FkmlbBiAj8fgfoZ8zJ+bZQCU5pdU55irXmJzFF/mXlSvBr2x/gmyLHaRu5iSpcA5Hw6CMLCCFSjB1GmgtNL2Qg=="
44+
crossorigin="anonymous">
45+
</script>
46+
{{ if $needmhchem -}}
47+
{{/* To add support for displaying chemical equations and physical units, load the mhchem extension: */ -}}
48+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.19/dist/contrib/mhchem.min.js"
49+
integrity="sha512-Cl4bz7Rt9ppgcBOQa4z96q3UqAzHgBzNDm66u2+lDe0ZJQu0Fgz+6jO57E+IZqzlhGzfNBY++pg7Ue+iopaLrg=="
50+
crossorigin="anonymous">
51+
</script>
52+
{{ end -}}
53+
{{/* To automatically render math in text elements, include the auto-render extension: */ -}}
54+
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.19/dist/contrib/auto-render.min.js"
55+
integrity="sha512-6bKDPShiPRjAcdeO8T6cedaVEi0pavPbzue/G/ZRiwVlurWZOSZ/vI9fr2lhk8IPXK7z51AZac+zBvZzgDJzDQ==" crossorigin="anonymous"
56+
{{ 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 }}>
57+
</script>
3158
{{ end -}}
3259

3360
{{ $jsBs := resources.Get "vendor/bootstrap/dist/js/bootstrap.bundle.js" -}}

layouts/partials/scripts/katex.html

Lines changed: 0 additions & 48 deletions
This file was deleted.

layouts/partials/scripts/mhchem.html

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)