Upgrade KaTex + workaround for Inline Math

For an equation to render inline make sure to wrap it within an inline shortcode so that the Markdown processor is not used for parsing.

Also note that for inline KaTex since `katex@0.11.1` use the `\( ... \)` delimiters and not the `$` sign.

Closes: #60
This commit is contained in:
Alexandros 2020-05-28 00:25:02 +03:00 committed by GitHub
parent c4afa25a5a
commit f6f3d298cc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -27,18 +27,20 @@ In this example we will be using [KaTeX](https://katex.org/)
{{< math.inline >}} {{< math.inline >}}
{{ if or .Page.Params.math .Site.Params.math }} {{ if or .Page.Params.math .Site.Params.math }}
<!-- KaTeX --> <!-- KaTeX -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/katex@0.10.1/dist/katex.min.css" integrity="sha384-dbVIfZGuN1Yq7/1Ocstc1lUEm+AT+/rCkibIcC/OmWo5f0EA48Vf8CytHzGrSwbQ" crossorigin="anonymous"> <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.10.1/dist/katex.min.js" integrity="sha384-2BKqo+exmr9su6dir+qCw08N2ZKRucY4PrGQPPWU1A7FtlCGjmEGFqXCv5nyM5Ij" crossorigin="anonymous"></script> <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.10.1/dist/contrib/auto-render.min.js" integrity="sha384-kWPLUVMOks5AQFrykwIup5lo0m3iMkkHrD0uJ4H5cjeGihAutqP0yW0J6dpFiVkI" crossorigin="anonymous" onload="renderMathInElement(document.body);"></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 }} {{ end }}
{{</ math.inline >}} {{</ math.inline >}}
### Examples ### Examples
{{< math.inline >}}
Inline math: $$ \varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887… $$ <p>
Inline math: \(\varphi = \dfrac{1+\sqrt5}{2}= 1.6180339887…\)
</p>
{{</ math.inline >}}
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} } }
$$ $$