Refactor KaTeX shortcode, remove whitespaces and fix font size
This commit is contained in:
parent
d61558462f
commit
e4e43bd9b1
2 changed files with 12 additions and 21 deletions
|
@ -7,20 +7,14 @@ KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX
|
||||||
|
|
||||||
```latex
|
```latex
|
||||||
{{</* katex [display] [class="text-center"] */>}}
|
{{</* katex [display] [class="text-center"] */>}}
|
||||||
x = \begin{cases}
|
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
a &\text{if } b \\
|
|
||||||
c &\text{if } d
|
|
||||||
\end{cases}
|
|
||||||
{{</* /katex */>}}
|
{{</* /katex */>}}
|
||||||
```
|
```
|
||||||
|
|
||||||
<--->
|
<--->
|
||||||
|
|
||||||
{{< katex >}}
|
{{< katex display >}}
|
||||||
x = \begin{cases}
|
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
a &\text{if } b \\
|
|
||||||
c &\text{if } d
|
|
||||||
\end{cases}
|
|
||||||
{{< /katex >}}
|
{{< /katex >}}
|
||||||
|
|
||||||
{{< /columns >}}
|
{{< /columns >}}
|
||||||
|
@ -29,9 +23,6 @@ x = \begin{cases}
|
||||||
|
|
||||||
Here is some inline example: {{< katex >}}\pi(x){{< /katex >}}, rendered in the same line. And below is `display` example, having `display: block`
|
Here is some inline example: {{< katex >}}\pi(x){{< /katex >}}, rendered in the same line. And below is `display` example, having `display: block`
|
||||||
{{< katex display >}}
|
{{< katex display >}}
|
||||||
x = \begin{cases}
|
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
|
||||||
a &\text{if } b \\
|
|
||||||
c &\text{if } d
|
|
||||||
\end{cases}
|
|
||||||
{{< /katex >}}
|
{{< /katex >}}
|
||||||
Text continues here.
|
Text continues here.
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
{{ if not (.Page.Scratch.Get "katex") }}
|
{{- if not (.Page.Scratch.Get "katex") -}}
|
||||||
<!-- Include katext only first time -->
|
<!-- Include katext only first time -->
|
||||||
<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}">
|
<link rel="stylesheet" href="{{ "katex/katex.min.css" | relURL }}" />
|
||||||
<script defer src="{{ "katex/katex.min.js" | relURL }}"></script>
|
<script defer src="{{ "katex/katex.min.js" | relURL }}"></script>
|
||||||
<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);"></script>
|
<script defer src="{{ "katex/auto-render.min.js" | relURL }}" onload="renderMathInElement(document.body);"></script>
|
||||||
{{ .Page.Scratch.Set "katex" true }}
|
{{- .Page.Scratch.Set "katex" true -}}
|
||||||
{{ end }}
|
{{- end -}}
|
||||||
|
|
||||||
<span class="katex{{ with .Get "class" }} {{ . }}{{ end }}">
|
<span {{- with .Get "class" }} class="{{ . }}"{{ end }}>
|
||||||
{{ if in .Params "display" }}\[{{ else }}\({{ end -}}
|
{{- cond (in .Params "display") "\\[" "\\(" -}}
|
||||||
{{ $.Inner }}
|
{{- trim .Inner "\n" -}}
|
||||||
{{- if in .Params "display" }}\]{{ else }}\){{ end }}
|
{{- cond (in .Params "display") "\\]" "\\)" -}}
|
||||||
</span>
|
</span>
|
||||||
|
|
Loading…
Reference in a new issue