Skip to content

Commit

Permalink
#583, fix katex and mermaid examples with raw html
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-shpak committed Feb 17, 2024
1 parent 01645fc commit a111041
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
18 changes: 11 additions & 7 deletions exampleSite/content.en/docs/shortcodes/katex.md
Expand Up @@ -6,26 +6,30 @@ title: KaTeX
KaTeX shortcode let you render math typesetting in markdown document. See [KaTeX](https://katex.org/)

## Example
{{< columns >}}

<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">

```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
{{</*/* /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
{{< /katex >}}

{{< /columns >}}
</div>
</div>

## 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`
{{< katex display >}}
{{< katex display=true >}}
f(x) = \int_{-\infty}^\infty\hat f(\xi)\,e^{2 \pi i \xi x}\,d\xi
{{< /katex >}}
Text continues here.
17 changes: 11 additions & 6 deletions exampleSite/content.en/docs/shortcodes/mermaid.md
Expand Up @@ -11,9 +11,12 @@ create a `mermaid.json` file in your `assets` folder!

## Example

{{< columns >}}

<div class="book-columns flex flex-wrap">
<div class="flex-even markdown-inner">

```tpl
{{</*/* mermaid [class="text-center"]*/*/>}}
{{</* mermaid class="optional" >}}
stateDiagram-v2
State1: The state with a note
note right of State1
Expand All @@ -22,12 +25,13 @@ stateDiagram-v2
end note
State1 --> State2
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
State1: The state with a note
note right of State1
Expand All @@ -38,4 +42,5 @@ stateDiagram-v2
note left of State2 : This is the note to the left.
{{< /mermaid >}}

{{< /columns >}}
</div>
</div>
1 change: 1 addition & 0 deletions layouts/shortcodes/html.html
@@ -0,0 +1 @@
{{- .Inner -}}
4 changes: 2 additions & 2 deletions layouts/shortcodes/katex.html
Expand Up @@ -7,7 +7,7 @@
{{- end -}}

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

0 comments on commit a111041

Please sign in to comment.