Welcome to mirror list, hosted at ThFree Co, Russian Federation.

katex.html « partials « layouts - gitlab.com/rmaguiar/hugo-theme-color-your-world.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: e336f80508953b52d72d08bbe4513b900f8e29b1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
<!-- KaTeX -->
{{ $katexVersion := "0.15.2" }}

{{ $katexCSS := resources.Get (printf "libs/katex@%s/dist/katex.css" $katexVersion) | minify | fingerprint }}
<link rel="stylesheet" href="{{ $katexCSS.Permalink }}" integrity="{{ $katexCSS.Data.Integrity }}" crossorigin="anonymous">

{{ $katexJS := resources.Get (printf "libs/katex@%s/dist/katex.js" $katexVersion) | minify | fingerprint }}
<script defer src="{{ $katexJS.Permalink }}" integrity="{{ $katexJS.Data.Integrity }}" crossorigin="anonymous"></script>


<!-- mhchem extension -->
{{ if or (in .Params.katexExtensions "mhchem") (in .Site.Params.katexExtensions "mhchem") }}

  {{ $mhchem := resources.Get (printf "libs/katex@%s/dist/contrib/mhchem.js" $katexVersion) | minify | fingerprint }}
  <script defer src="{{ $mhchem.Permalink }}" integrity="{{ $mhchem.Data.Integrity }}" crossorigin="anonymous"></script>

{{ end }}


<!-- copy-tex extension -->
{{ if or (in .Params.katexExtensions "copy-tex") (in .Site.Params.katexExtensions "copy-tex") }}

  {{ $copyTexCSS := resources.Get (printf "libs/katex@%s/dist/contrib/copy-tex.css" $katexVersion) | minify | fingerprint }}
  <link rel="stylesheet" href="{{ $copyTexCSS.Permalink }}" integrity="{{ $copyTexCSS.Data.Integrity }}" crossorigin="anonymous">

  {{ $copyTexJS := resources.Get (printf "libs/katex@%s/dist/contrib/copy-tex.js" $katexVersion) | minify | fingerprint }}
  <script defer src="{{ $copyTexJS.Permalink }}" integrity="{{ $copyTexJS.Data.Integrity }}" crossorigin="anonymous"></script>
  
{{ end }}


<!--
  auto-render extension + auto-render options + tabindex HACK (see below)
  
  Chrome will ignore "scroll" elements while navigating
  via keyboard (while Firefox will not)
  
  The workaround used here is to inject "tabindex=0" after
  the auto-render extension work is done
-->
{{ $autoRender := resources.Get (printf "libs/katex@%s/dist/contrib/auto-render.js" $katexVersion) }}
{{ $katexAutoRenderOptions := resources.Get "js/katex-auto-render-options.js" }}
{{ $katexPostRender := resources.Get "js/katex-post-render.js" | resources.ExecuteAsTemplate "js/katex-post-render.js" . }}

{{ $katexCustomRender := slice $autoRender $katexAutoRenderOptions $katexPostRender | resources.Concat "js/katex-custom-render.js" | minify | fingerprint }}
<script defer src="{{ $katexCustomRender.Permalink }}" integrity="{{ $katexCustomRender.Data.Integrity }}" crossorigin="anonymous"></script>