mirror of
https://github.com/MeiK2333/github-style.git
synced 2025-10-07 01:54:06 +00:00
add latex support; activate when latex: true is set in markdown file
This commit is contained in:
17
README.md
17
README.md
@@ -56,7 +56,7 @@ summary: "The summary content"
|
|||||||
---
|
---
|
||||||
```
|
```
|
||||||
|
|
||||||
### Approch 2: use <!--more-->
|
### Approch 2: use `<!--more-->`
|
||||||
Use `<!--more-->` to seperate content that will display in the posts page as abstraction and the rest of the content. This is different from summary, as summary will not appear in the post.
|
Use `<!--more-->` to seperate content that will display in the posts page as abstraction and the rest of the content. This is different from summary, as summary will not appear in the post.
|
||||||
```
|
```
|
||||||
---
|
---
|
||||||
@@ -69,6 +69,21 @@ abstraction show in the post page
|
|||||||
other content
|
other content
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Support LaTex
|
||||||
|
In you post add `katex:true` to [front matter](https://gohugo.io/content-management/front-matter/)
|
||||||
|
```
|
||||||
|
---
|
||||||
|
katex: true
|
||||||
|
---
|
||||||
|
```
|
||||||
|
Then the [katex script](https://katex.org/docs/autorender.html) will auto render the string enclosed be delimiters.
|
||||||
|
```
|
||||||
|
# replace ... with latex formula
|
||||||
|
display inline \\( ... \\)
|
||||||
|
display block $$ ... $$
|
||||||
|
```
|
||||||
|

|
||||||
|
|
||||||
## config.toml example
|
## config.toml example
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
|
BIN
images/latex_example.png
Normal file
BIN
images/latex_example.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
@@ -23,5 +23,7 @@
|
|||||||
<span class="f6 text-gray-light"></span>
|
<span class="f6 text-gray-light"></span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{{ if .Params.katex }}
|
||||||
|
{{ partial "katex.html" . }}
|
||||||
|
{{ end }}
|
||||||
{{ partial "script.html" . }}
|
{{ partial "script.html" . }}
|
||||||
|
4
layouts/partials/katex.html
Normal file
4
layouts/partials/katex.html
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.css" integrity="sha384-AfEj0r4/OFrOo5t7NnNe46zW/tFgW6x/bCJG8FqQCEo3+Aro6EYUG4+cU+KJWu/X" crossorigin="anonymous">
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/katex.min.js" integrity="sha384-g7c+Jr9ZivxKLnZTDUhnkOnsh30B4H0rpLUpJ4jAIKs4fnJI+sEnkvrMWph2EDg4" crossorigin="anonymous"></script>
|
||||||
|
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.12.0/dist/contrib/auto-render.min.js" integrity="sha384-mll67QQFJfxn0IYznZYonOWZ644AWYC+Pt2cHqMaRhXVrursRwvLnLaebdGIlYNa" crossorigin="anonymous"
|
||||||
|
onload="renderMathInElement(document.body);"></script>
|
Reference in New Issue
Block a user