add math support
This commit is contained in:
parent
20e785dd77
commit
7ba9f09fee
4 changed files with 31 additions and 7 deletions
|
@ -1,5 +1,5 @@
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<h1>Paper <sup><sup><sub>6.10</sub></sup></sup></h1>
|
<h1>Paper <sup><sup><sub>6.11</sub></sup></sup></h1>
|
||||||
|
|
||||||
Demo → [hugo-paper.vercel.app](https://hugo-paper.vercel.app/)
|
Demo → [hugo-paper.vercel.app](https://hugo-paper.vercel.app/)
|
||||||
|
|
||||||
|
@ -71,12 +71,14 @@ disqusShortname = 'YOUR_DISQUS_SHORTNAME' # use disqus comments
|
||||||
monoDarkIcon = true # show monochrome dark mode icon
|
monoDarkIcon = true # show monochrome dark mode icon
|
||||||
gravatarCdn = 'GRAVATAR_CDN_LINK' # e.g. 'https://cdn.v2ex.com/gravatar/'
|
gravatarCdn = 'GRAVATAR_CDN_LINK' # e.g. 'https://cdn.v2ex.com/gravatar/'
|
||||||
graphCommentId = "YOUR_GRAPH_COMMENT_ID" # use graph comment (disqus alternative)
|
graphCommentId = "YOUR_GRAPH_COMMENT_ID" # use graph comment (disqus alternative)
|
||||||
|
math = true # enable KaTex math typesetting globally
|
||||||
```
|
```
|
||||||
|
|
||||||
Available options to front matter:
|
Available options to front matter:
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
comments = false # disable comments for a specific page
|
comments = false # disable comments for a specific page
|
||||||
|
math = true # enable KaTex math typesetting for a specific page
|
||||||
```
|
```
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
|
@ -28,13 +28,7 @@ In this example we will be using [KaTeX](https://katex.org/)
|
||||||
**Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html)
|
**Note:** Use the online reference of [Supported TeX Functions](https://katex.org/docs/supported.html)
|
||||||
|
|
||||||
{{< math.inline >}}
|
{{< math.inline >}}
|
||||||
{{ if or .Page.Params.math .Site.Params.math }}
|
|
||||||
|
|
||||||
<!-- KaTeX -->
|
|
||||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.css" integrity="sha384-zB1R0rpPzHqg7Kpt0Aljp8JPLqbXI3bhnPWROx27a9N0Ll6ZP/+DiW/UqRcLbRjq" crossorigin="anonymous">
|
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/katex.min.js" integrity="sha384-y23I5Q6l+B6vatafAwxRu/0oK/79VlbSz7Q9aiSZUvyWYIYsd+qj+o24G5ZU2zJz" crossorigin="anonymous"></script>
|
|
||||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.11.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></script>
|
|
||||||
{{ end }}
|
|
||||||
{{</ math.inline >}}
|
{{</ math.inline >}}
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
@ -44,6 +38,7 @@ In this example we will be using [KaTeX](https://katex.org/)
|
||||||
<p>
|
<p>
|
||||||
Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
|
Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
{{</ math.inline >}}
|
{{</ math.inline >}}
|
||||||
|
|
||||||
Block math:
|
Block math:
|
||||||
|
|
|
@ -57,6 +57,14 @@
|
||||||
{{ range $.Scratch.Get "social_list" }}
|
{{ range $.Scratch.Get "social_list" }}
|
||||||
<link rel="preload" as="image" href="{{ printf `%s.svg` . | absURL }}" />
|
<link rel="preload" as="image" href="{{ printf `%s.svg` . | absURL }}" />
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
<!---->
|
||||||
|
|
||||||
|
{{ if or .Params.math .Site.Params.math }}
|
||||||
|
<!---->
|
||||||
|
{{ partial "math.html" . }}
|
||||||
|
<!---->
|
||||||
|
{{ end }}
|
||||||
|
<!---->
|
||||||
|
|
||||||
<!-- Favicon -->
|
<!-- Favicon -->
|
||||||
<link rel="icon" href="{{ `favicon.ico` | absURL }}" />
|
<link rel="icon" href="{{ `favicon.ico` | absURL }}" />
|
||||||
|
|
19
layouts/partials/math.html
Normal file
19
layouts/partials/math.html
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
<link
|
||||||
|
rel="stylesheet"
|
||||||
|
href="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/katex.min.css"
|
||||||
|
integrity="sha384-3UiQGuEI4TTMaFmGIZumfRPtfKQ3trwQE2JgosJxCnGmQpL/lJdjpcHkaaFwHlcI"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
/>
|
||||||
|
<script
|
||||||
|
defer
|
||||||
|
src="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/katex.min.js"
|
||||||
|
integrity="sha384-G0zcxDFp5LWZtDuRMnBkk3EphCK1lhEf4UEyEM693ka574TZGwo4IWwS6QLzM/2t"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
></script>
|
||||||
|
<script
|
||||||
|
defer
|
||||||
|
src="https://cdn.jsdelivr.net/npm/katex@0.16.7/dist/contrib/auto-render.min.js"
|
||||||
|
integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05"
|
||||||
|
crossorigin="anonymous"
|
||||||
|
onload="renderMathInElement(document.body);"
|
||||||
|
></script>
|
Loading…
Reference in a new issue