#583, fix katex and mermaid examples with raw html

This commit is contained in:
Alex Shpak 2024-02-17 18:57:02 +01:00
parent 01645fc56d
commit a111041867
4 changed files with 25 additions and 15 deletions

View file

@ -6,26 +6,30 @@ title: KaTeX
KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/) KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/)
## Example ## Example
{{< columns >}}
<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">
```latex ```latex
{{</*/* katex [display] [class="text-center"] */*/>}} {{</* katex display=true class="optional" >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{</*/* /katex */*/>}} {{< /katex */>}}
``` ```
<---> </div>
<div class="flex-even markdown-inner">
{{< katex display >}} {{< katex display=true class="optional" >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}} {{< /katex >}}
{{< /columns >}} </div>
</div>
## Display Mode Example ## Display Mode Example
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=true >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}} {{< /katex >}}
Text continues here. Text continues here.

View file

@ -11,9 +11,12 @@ create a `mermaid.json` file in your `assets` folder!
## Example ## Example
{{< columns >}}
<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">
```tpl ```tpl
{{</*/* mermaid [class="text-center"]*/*/>}} {{</* mermaid class="optional" >}}
stateDiagram-v2 stateDiagram-v2
State1: The state with a note State1: The state with a note
note right of State1 note right of State1
@ -22,12 +25,13 @@ stateDiagram-v2
end note end note
State1 --> State2 State1 --> State2
note left of State2 : This is the note to the left. note left of State2 : This is the note to the left.
{{</*/* /mermaid */*/>}} {{< /mermaid */>}}
``` ```
<---> </div>
<div class="flex-even markdown-inner">
{{< mermaid >}} {{< mermaid class="optional" >}}
stateDiagram-v2 stateDiagram-v2
State1: The state with a note State1: The state with a note
note right of State1 note right of State1
@ -38,4 +42,5 @@ stateDiagram-v2
note left of State2 : This is the note to the left. note left of State2 : This is the note to the left.
{{< /mermaid >}} {{< /mermaid >}}
{{< /columns >}} </div>
</div>

View file

@ -0,0 +1 @@
{{- .Inner -}}

View file

@ -7,7 +7,7 @@
{{- end -}} {{- end -}}
<span {{- with .Get "class" }} class="{{ . }}"{{ end }}> <span {{- with .Get "class" }} class="{{ . }}"{{ end }}>
{{ cond (in .Params "display") "\\[" "\\(" -}} {{ with .Get "display" }}\[{{else}}\({{end}}
{{- trim .Inner "\n" -}} {{- trim .Inner "\n" -}}
{{- cond (in .Params "display") "\\]" "\\)" }} {{ with .Get "display" }}\]{{else}}\){{end}}
</span> </span>