katex config bug fix
This commit is contained in:
parent
4447dcc036
commit
2062f15bee
|
@ -16,21 +16,13 @@ libraries:
|
||||||
featured_image: "feature2/mathbook.png"
|
featured_image: "feature2/mathbook.png"
|
||||||
---
|
---
|
||||||
|
|
||||||
{{< box >}}
|
|
||||||
We need goldmark katex entension which is not yet we have:
|
|
||||||
[https://github.com/gohugoio/hugo/issues/6544](https://github.com/gohugoio/hugo/issues/6544)
|
|
||||||
{{< /box >}}
|
|
||||||
|
|
||||||
|
|
||||||
The following
|
The following
|
||||||
|
|
||||||
$$ \int_{a}^{b} x^2 dx $$
|
$$ \int_{a}^{b} x^2 dx $$
|
||||||
|
|
||||||
Is an integral
|
Is an integral
|
||||||
|
|
||||||
$$
|
$$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } $$
|
||||||
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
|
|
||||||
$$
|
|
||||||
|
|
||||||
Enable Katex in the config file by setting the `katex` param to `true`. This will import the necessary Katex CSS/JS.
|
Enable Katex in the config file by setting the `katex` param to `true`. This will import the necessary Katex CSS/JS.
|
||||||
|
|
||||||
|
@ -39,21 +31,17 @@ See the online reference of [supported TeX functions](https://katex.org/docs/sup
|
||||||
**Note:** For inline math to render correctly, your content file extension must be `.mmark`. See the [official mmark site](https://mmark.nl/).
|
**Note:** For inline math to render correctly, your content file extension must be `.mmark`. See the [official mmark site](https://mmark.nl/).
|
||||||
|
|
||||||
```
|
```
|
||||||
Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$
|
Inline math: $ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $
|
||||||
```
|
```
|
||||||
|
|
||||||
Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$
|
Inline math: $ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $
|
||||||
|
|
||||||
```
|
```
|
||||||
Block math:
|
Block math:
|
||||||
|
|
||||||
$$
|
$$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } $$
|
||||||
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
|
|
||||||
$$
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Block math:
|
Block math:
|
||||||
|
|
||||||
$$
|
$$ \varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } } $$
|
||||||
\varphi = 1+\frac{1} {1+\frac{1} {1+\frac{1} {1+\cdots} } }
|
|
||||||
$$
|
|
|
@ -436,11 +436,14 @@
|
||||||
// ============================= katex =============================
|
// ============================= katex =============================
|
||||||
if (lib && lib.includes('katex')) {
|
if (lib && lib.includes('katex')) {
|
||||||
var mathElements = document.getElementsByClassName('math');
|
var mathElements = document.getElementsByClassName('math');
|
||||||
var options = [
|
var options = {
|
||||||
{ left: "$$", right: "$$", display: true },
|
delimiters: [
|
||||||
{ left: "\\(", right: "\\)", display: false },
|
{ left: "$$", right: "$$", display: true },
|
||||||
{ left: "\\[", right: "\\]", display: true }
|
{ left: "\\[", right: "\\]", display: true },
|
||||||
];
|
{ left: "$", right: "$", display: false },
|
||||||
|
{ left: "\\(", right: "\\)", display: false }
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
renderMathInElement(document.querySelector('.single__contents'), options);
|
renderMathInElement(document.querySelector('.single__contents'), options);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue