hugo-geekdoc/layouts/shortcodes/katex.html

19 lines
635 B
HTML
Raw Permalink Normal View History

2022-02-22 20:45:14 +00:00
<!-- prettier-ignore-start -->
{{ if not (.Page.Scratch.Get "katex") }}
2022-02-22 20:45:14 +00:00
<!-- Include katex only first time -->
<link
rel="stylesheet"
href="{{ index (index .Site.Data.assets "katex.css") "src" | relURL }}"
2022-02-22 20:45:14 +00:00
/>
<script defer src="{{ index (index .Site.Data.assets "katex.js") "src" | relURL }}"></script>
{{ .Page.Scratch.Set "katex" true }}
{{ end }}
2022-02-22 20:45:14 +00:00
<!-- prettier-ignore-end -->
<span class="gdoc-katex {{ with .Get "class" }}{{ . }}{{ end }}">
{{ cond (in .Params "display") "\\[" "\\(" -}}
{{- trim .Inner "\n" -}}
{{- cond (in .Params "display") "\\]" "\\)" -}}
</span>
{{- /* Drop trailing newlines */ -}}