Add math render codeblock and math shortcode.

This commit is contained in:
Fredrik Jonsson 2023-04-13 14:39:56 +02:00
commit 936892fe7b
4 changed files with 37 additions and 1 deletions

View file

@ -0,0 +1,6 @@
{{ .Page.Store.Set "math" true -}}
<p{{ with .Attributes.class }} class="{{ . }}"{{ end }}>
$$
{{ .Inner }}
$$
</p>

View file

@ -10,7 +10,7 @@
{{ partial "meta_json_ld.html" . }}
{{ partial "scripts.html" . }}
{{ partialCached "tracking.html" . }}
{{ if $.Param "math" }}{{ partialCached "math.html" . }}{{ end -}}
{{ partialCached "math.html" . }}
</head>
<body class="{{ if .IsPage }}single-page{{ else }}list-page{{ end }}{{ if .IsHome }} front{{ end }}{{ with $.Param "bodyclass" }} {{ . }}{{ end }}">

View file

@ -1,5 +1,7 @@
{{ if or ($.Param "math") (.Page.Store.Get "math") (.HasShortcode "math") -}}
<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}">
<script defer src="{{ "katex/katex.min.js" | relURL }}"></script>
<script defer src="{{ "katex/contrib/auto-render.min.js" | relURL }}"></script>
{{ $math := resources.Get "js/math.js" | minify | fingerprint -}}
<script defer src="{{ $math.RelPermalink }}"></script>
{{ end -}}

View file

@ -0,0 +1 @@
${{ .Inner }}$