feat: add mhchem support

This commit is contained in:
Xin 2023-08-19 00:32:10 +01:00
parent 8298278a42
commit 57f298256d
3 changed files with 17 additions and 0 deletions

1
assets/vendor/katex/mhchem.min.js vendored Normal file

File diff suppressed because one or more lines are too long

View File

@ -42,3 +42,17 @@ $$F(\omega) = \int_{-\infty}^{\infty} f(t) e^{-j\omega t} \, dt$$
## Supported Functions
For a list of supported functions, see [KaTeX supported functions](https://katex.org/docs/supported.html).
## Chemistry
Chemistry expressions are supported via [mhchem](https://mhchem.github.io/MathJax-mhchem/) extension.
Inline: $\ce{H2O}$ is water.
Separate paragraph:
```markdown {filename="page.md"}
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$
```
$$\ce{Hg^2+ ->[I-] HgI2 ->[I-] [Hg^{II}I4]^2-}$$

View File

@ -40,10 +40,12 @@
{{- if and (not site.Params.math.disabled) .Page.Params.math -}}
{{- $katexCSS := resources.Get "vendor/katex/katex.min.css" | fingerprint -}}
{{- $katexJS := resources.Get "vendor/katex/katex.min.js" | fingerprint -}}
{{- $mhchemJS := resources.Get "vendor/katex/mhchem.min.js" | fingerprint -}}
{{- $katexAutoRenderJS := resources.Get "vendor/katex/auto-render.min.js" | fingerprint -}}
<link type="text/css" rel="stylesheet" href="{{ $katexCSS.RelPermalink }}" integrity="{{ $katexCSS.Data.Integrity }}" />
<script defer src="{{ $katexJS.RelPermalink }}" integrity="{{ $katexJS.Data.Integrity }}"></script>
<script defer src="{{ $katexAutoRenderJS.RelPermalink }}" integrity="{{ $katexAutoRenderJS.Data.Integrity }}"></script>
<script defer src="{{ $mhchemJS.RelPermalink }}" integrity="{{ $mhchemJS.Data.Integrity }}"></script>
{{ $katexFonts := resources.Match "vendor/katex/fonts/*" }}
{{- range $katexFonts -}}
{{ .Publish }}