更新 KaTeX 到 0.16.2 版本.
Signed-off-by: lion.chan <cy187lion@sina.com>
This commit is contained in:
parent
7e759e0d14
commit
a6f9b98f92
|
@ -76,21 +76,12 @@ Hugo 默认不支持 LaTex 的渲染,需要使用第三方插件如 KaTeX 等
|
|||
|
||||
```html
|
||||
<!-- CSS -->
|
||||
<link rel="stylesheet"
|
||||
href="https://cdn.jsdelivr.net/npm/katex@0.13.2/dist/katex.min.css"
|
||||
integrity="sha384-Cqd8ihRLum0CCg8rz0hYKPoLZ3uw+gES2rXQXycqnL5pgVQIflxAUDS7ZSjITLb5"
|
||||
crossorigin="anonymous">
|
||||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.css" integrity="sha384-bYdxxUwYipFNohQlHt0bjN/LCpueqWz13HufFEV1SUatKs1cm4L6fFgCi1jT643X" crossorigin="anonymous">
|
||||
<!-- The loading of KaTeX is deferred to speed up page rendering -->
|
||||
<script defer
|
||||
src="https://cdn.jsdelivr.net/npm/katex@0.13.2/dist/katex.min.js"
|
||||
integrity="sha384-1Or6BdeNQb0ezrmtGeqQHFpppNd7a/gw29xeiSikBbsb44xu3uAo8c7FwbF5jhbd"
|
||||
crossorigin="anonymous"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/katex.min.js" integrity="sha384-Qsn9KnoKISj6dI8g7p1HBlNpVx0I8p1SvlwOldgi3IorMle61nQy4zEahWYtljaz" crossorigin="anonymous"></script>
|
||||
<!-- To automatically render math in text elements, include the auto-render extension -->
|
||||
<script defer
|
||||
src="https://cdn.jsdelivr.net/npm/katex@0.13.2/dist/contrib/auto-render.min.js"
|
||||
integrity="sha384-vZTG03m+2yp6N6BNi5iM4rW4oIwk5DfcNdFfxkk9ZWpDriOkXX8voJBFrAO7MpVl"
|
||||
crossorigin="anonymous"
|
||||
onload="renderMathInElement(document.body);"></script>
|
||||
<script defer src="https://cdn.jsdelivr.net/npm/katex@0.16.2/dist/contrib/auto-render.min.js" integrity="sha384-+VBxd3r6XgURycqtZ117nYw44OOcIax56Z4dCRWbxyPt0Koah1uHoK0o4+/RRE05" crossorigin="anonymous"
|
||||
onload="renderMathInElement(document.body);"></script>
|
||||
|
||||
<script>
|
||||
document.addEventListener("DOMContentLoaded", function () {
|
||||
|
@ -107,6 +98,8 @@ Hugo 默认不支持 LaTex 的渲染,需要使用第三方插件如 KaTeX 等
|
|||
|
||||
注意,以上的 href 和 src 都引用了网络资源,因此无需将相关文件下载到本地。
|
||||
|
||||
在 [这里](https://katex.org/docs/browser.html) 可以获得以上代码片段的更多参考。
|
||||
|
||||
### 7.2. 引用 KaTeX 文件
|
||||
|
||||
需要在每个静态页的 header 或 footer 部分引用 katex.html 文件,这样才能正确渲染 LaTex 公式。以下以修改 header 为例,修改 \<Hugo>/themes/\<hugo-theme-xxx>/layouts/partials/head.html 文件,在 OGP 部分的末尾处增加如下内容:
|
||||
|
|
Loading…
Reference in New Issue