feat: add katex math typesetting shortcode (#157)
This commit is contained in:
parent
823ce1273f
commit
550745e727
24 changed files with 149 additions and 14 deletions
14
layouts/shortcodes/katex.html
Normal file
14
layouts/shortcodes/katex.html
Normal file
|
@ -0,0 +1,14 @@
|
|||
{{ if not (.Page.Scratch.Get "katex") }}
|
||||
<!-- Include katext only first time -->
|
||||
<link rel="stylesheet" href="{{ index .Site.Data.assets "katex.min.css" | relURL }}" />
|
||||
<script defer src="{{ index .Site.Data.assets "js/katex.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/auto-render.min.js" | relURL }}"></script>
|
||||
<script defer src="{{ index .Site.Data.assets "js/katex-loader.min.js" | relURL }}"></script>
|
||||
{{ .Page.Scratch.Set "katex" true }}
|
||||
{{ end }}
|
||||
|
||||
<span class="gdoc-katex katex{{ with .Get "class" }} {{ . }}{{ end }}">
|
||||
{{ cond (in .Params "display") "\\[" "\\(" -}}
|
||||
{{- trim .Inner "\n" -}}
|
||||
{{- cond (in .Params "display") "\\]" "\\)" }}
|
||||
</span>
|
Loading…
Add table
Add a link
Reference in a new issue