hugo-book-theme/layouts/shortcodes/katex.html

15 lines
989 B
HTML
Raw Normal View History

2019-08-22 23:59:51 +02:00
{{ if not (.Page.Scratch.Get "katex") }}
<!-- Include katext only first time -->
2019-12-01 14:54:37 +01:00
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous"
onload="renderMathInElement(document.body);"></script>
2019-08-22 23:59:51 +02:00
{{ .Page.Scratch.Set "katex" true }}
{{ end }}
<span class="katex{{ with .Get "class" }} {{ . }}{{ end }}">
{{ if in .Params "display" }}\[{{ else }}\({{ end -}}
{{ $.Inner }}
{{- if in .Params "display" }}\]{{ else }}\){{ end }}
</span>