File tree Expand file tree Collapse file tree 9 files changed +113
-21
lines changed
exampleSite/content/english/post Expand file tree Collapse file tree 9 files changed +113
-21
lines changed Original file line number Diff line number Diff line change 1717 uses : peaceiris/actions-hugo@v3
1818 with :
1919 extended : true
20- hugo-version : 0.147.5
20+ hugo-version : 0.147.8
2121 - name : setup node
2222 uses : actions/setup-node@v4
2323 with :
Original file line number Diff line number Diff line change 1+ mediaTypes :
2+ font/woff :
3+ suffixes :
4+ - woff
5+ font/woff2 :
6+ suffixes :
7+ - woff2
Original file line number Diff line number Diff line change 3939Chemical equations:
4040
4141\[
42- \tag\ * {(2)} \ce{Zn^2+ <=>[ + 2OH-] [ + 2H+ ] $\underset{\text{amphoteric hydroxide}}{\ce{Zn(OH)2 v}}$ <=>[ + 2OH-] [ + 2H+ ] $\underset{\text{tetrahydroxozincate}}{\ce{[ Zn(OH)4] ^2-}}$}
42+ \tag* {(2)} \ce{Zn^2+ <=>[ + 2OH-] [ + 2H+ ] $\underset{\text{amphoteric hydroxide}}{\ce{Zn(OH)2 v}}$ <=>[ + 2OH-] [ + 2H+ ] $\underset{\text{tetrahydroxozincate}}{\ce{[ Zn(OH)4] ^2-}}$}
4343\]
4444
4545** Note:** Use the online reference of [ Supported TeX Functions] ( https://katex.org/docs/supported.html )
46+
47+ ### Mathematical formulae inside code blocks
48+
49+ As an alternative to the standard syntax used above, formulae can also be
50+ authored using a
51+ [ GLFM math block] ( https://docs.gitlab.com/ee/user/markdown.html#math ) :
52+
53+ ```` markdown
54+ The probability of getting \(k\) heads when flipping \(n\) coins is:
55+
56+ ```math
57+ \tag*{(1)} P(E) = {n \choose k} p^k (1-p)^{n-k}
58+ ```
59+ ````
60+
61+ This ` math ` block renders to:
62+
63+ The probability of getting \( k\) heads when flipping \( n\) coins is:
64+
65+ ``` math
66+ \tag*{(1)} P(E) = {n \choose k} p^k (1-p)^{n-k}
67+ ```
68+
69+ ### Chemical equations inside code blocks
70+
71+ You can use a code block adorned with ` chem ` in order to render
72+ a chemical equation:
73+
74+ ```` markdown
75+ ```chem
76+ \tag*{(2)} \ce{Hg^2+ ->[I-] $\underset{\mathrm{red}}{\ce{HgI2}}$ ->[I-] $\underset{\mathrm{red}}{\ce{[Hg^{II}I4]^2-}$}
77+ ```
78+ ````
79+
80+ This ` chem ` block renders to:
81+
82+ <!-- prettier-ignore-start -->
83+ ``` chem
84+ \tag*{(2)} \ce{Hg^2+ ->[I-] $\underset{\mathrm{red}}{\ce{HgI2}}$ ->[I-] $\underset{\mathrm{red}}{\ce{[Hg^{II}I4]^2-}}$}
85+ ```
86+ <!-- prettier-ignore-end -->
Original file line number Diff line number Diff line change 1+ {{ partial "math.html" . -}}
Original file line number Diff line number Diff line change 1+ {{ partial "math.html" . -}}
Original file line number Diff line number Diff line change 235235 <!-- KaTeX-->
236236 {{ $noop := .WordCount }}
237237 {{ if .Page.Store.Get "hasMath" }}
238- {{ $katex_css_url := printf "https://cdn.jsdelivr.net/npm/katex@latest/dist/katex%s.css" (cond hugo.IsProduction ".min" "") -}}
239- {{ with try (resources.GetRemote $katex_css_url) -}}
240- {{ with .Err -}}
241- {{ errorf "Could not retrieve KaTeX css file from CDN. Reason: %s." . -}}
242- {{ else with.Value -}}
243- {{ with resources.Copy (printf "css/katex%s.css" (cond hugo.IsProduction ".min" "")) . }}
244- {{ $secureCSS := . | resources.Fingerprint "sha512" -}}
245- < link
246- rel ="stylesheet "
247- href ="{{- .RelPermalink -}} "
248- integrity ="{{- $secureCSS.Data.Integrity -}} "
249- crossorigin ="anonymous "
250- />
251- {{ end -}}
252- {{ end -}}
253- {{ end -}}
238+ {{ partial "katex.html" . }}
254239 {{ end }}
255240</ head >
Original file line number Diff line number Diff line change 1+ {{/* stylesheet */ -}}
2+
3+ {{ $cssFile := cond hugo.IsProduction "katex.min.css" "katex.css" -}}
4+ {{ $cssUrl := printf "https://unpkg.com/katex@latest/dist/%s" $cssFile -}}
5+ {{ with try (resources.GetRemote $cssUrl) -}}
6+ {{ with .Err -}}
7+ {{ errorf "Could not retrieve KaTeX css file from CDN. Reason: %s." . -}}
8+ {{ else with .Value -}}
9+ {{ with resources.Copy (printf "css/%s" $cssFile) . -}}
10+ {{ $cssHash := . | fingerprint "sha512" -}}
11+ < link
12+ rel ="stylesheet "
13+ href ="{{- .RelPermalink -}} "
14+ integrity ="{{- $cssHash.Data.Integrity -}} "
15+ crossorigin ="anonymous ">
16+ {{ end -}}
17+ {{ end -}}
18+ {{ end -}}
19+
20+ {{/* font files */ -}}
21+
22+ {{ $fontFiles := slice -}}
23+ {{ $data := dict -}}
24+ {{ $url := "https://unpkg.com/katex@latest/dist/fonts?meta" -}}
25+ {{ with try (resources.GetRemote $url) -}}
26+ {{ with .Err -}}
27+ {{ errorf "%s" . -}}
28+ {{ else with ( .Value | unmarshal ) -}}
29+ {{ range .files -}}
30+ {{ $fontFiles = $fontFiles | append .path -}}
31+ {{ end -}}
32+ {{ else -}}
33+ {{ errorf "Unable to get remote resource %q" $url -}}
34+ {{ end -}}
35+ {{ end -}}
36+
37+ {{ range $fontFile := $fontFiles -}}
38+ {{ $fontUrl := (printf "https://unpkg.com/katex@latest%s" $fontFile) -}}
39+ {{ with try (resources.GetRemote $fontUrl) -}}
40+ {{ with .Err -}}
41+ {{ errorf "Could not retrieve KaTeX font file from CDN. Reason: %s." . -}}
42+ {{ else with .Value -}}
43+ {{ with resources.Copy (printf "css/fonts/%s" (replace $fontFile "/dist/fonts/" "")) . -}}
44+ {{ .Publish -}}
45+ {{ end -}}
46+ {{ end -}}
47+ {{ end -}}
48+ {{ end -}}
Original file line number Diff line number Diff line change 1+ {{ $opts := dict "output" "htmlAndMathml" "displayMode" (not (eq ($.Type) "inline")) -}}
2+ {{ with try (transform.ToMath .Inner $opts) -}}
3+ {{ with .Err -}}
4+ {{ errorf "Unable to render mathematical markup to HTML using the transform.ToMath function. The KaTeX display engine threw the following error: %s." . $.Position -}}
5+ {{ else -}}
6+ {{ .Value -}}
7+ {{ $.Page.Store.Set "hasMath" true -}}
8+ {{ end -}}
9+ {{ end -}}
Original file line number Diff line number Diff line change 1010 """
1111
1212[build .environment ]
13- HUGO_VERSION = " 0.147.5 "
14- DART_SASS_VERSION = " 1.89.0 "
13+ HUGO_VERSION = " 0.147.8 "
14+ DART_SASS_VERSION = " 1.89.1 "
1515 NODE_VERSION = " 24"
16- GO_VERSION = " 1.24.3 "
16+ GO_VERSION = " 1.24.4 "
1717 HUGO_ENV = " production"
1818 HUGO_THEME = " repo"
1919 HUGO_BASEURL = " https://anatole-demo.netlify.app"
You can’t perform that action at this time.
0 commit comments