mirror of
https://github.com/loikein/hugo-tufte.git
synced 2024-12-23 22:09:44 +01:00
28 lines
1.4 KiB
HTML
28 lines
1.4 KiB
HTML
<!-- <script src="{{ "/js/math-code.js" | relURL }}"></script> -->
|
|
{{ $script := resources.Get "latex-fix.js" | resources.Minify }}
|
|
{{ with $script.Content }}
|
|
<script>{{ . | safeJS }}</script>
|
|
{{ end }}
|
|
|
|
<link rel="stylesheet" href="{{ .Site.Params.KaTeXCDN }}/katex@{{ .Site.Params.KaTeXVersion }}/dist/katex.min.css" crossorigin="anonymous">
|
|
<script defer src="{{ .Site.Params.KaTeXCDN }}/katex@{{ .Site.Params.KaTeXVersion }}/dist/katex.min.js" crossorigin="anonymous"></script>
|
|
<script defer src="{{ .Site.Params.KaTeXCDN }}/katex@{{ .Site.Params.KaTeXVersion }}/dist/contrib/auto-render.min.js" crossorigin="anonymous"></script>
|
|
<!-- do not add onload attributes, breaks settings below -->
|
|
<script>
|
|
document.addEventListener("DOMContentLoaded", function() {
|
|
renderMathInElement(document.body, {
|
|
// delimiters: [
|
|
// {left: "$$\n", right: "\n$$", display: true},
|
|
// {left: "$$", right: "$$", display: false},
|
|
// {left: "\\[", right: "\\]", display: true},
|
|
// {left: "\\(", right: "\\)", display: false}
|
|
// ],
|
|
trust: (context) => ['\\htmlId', '\\href'].includes(context.command),
|
|
macros: {
|
|
"\\eqref": "\\href{###1}{(\\text{#1})}",
|
|
"\\ref": "\\href{###1}{\\text{#1}}",
|
|
"\\label": "\\htmlId{#1}{}"
|
|
}
|
|
});
|
|
});
|
|
</script>
|