Skip to content

Commit 421d988

Browse files
committed
all: render mermaid diagrams client-side
1 parent d4a1272 commit 421d988

File tree

6 files changed

+14
-33
lines changed

6 files changed

+14
-33
lines changed

content/docs/reference/custom-interactions.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ An interaction's lifetime starts with the initial _interaction_ with an _interac
3535
interaction.
3636
4. _(optional)_ Continue to send followup responses for up to 15 minutes until the interaction token expires.
3737

38-
```kroki {type=mermaid}
38+
```mermaid
3939
graph LR;
4040
A[Button pressed] --> B{CC Triggered}
4141
C[Menu used] --> B
@@ -421,7 +421,7 @@ A `row` must also be a slice. It either contains 1-5 buttons, _or_ a single sele
421421

422422
Below is an example of a `components` structure.
423423

424-
```kroki {type=mermaid}
424+
```mermaid
425425
graph TB
426426
subgraph Components
427427
subgraph Row 1

layouts/_default/_markup/render-codeblock-kroki.html

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<pre class="mermaid">
2+
{{- .Inner | safeHTML }}
3+
</pre>
4+
{{ .Page.Store.Set "hasMermaid" true }}

layouts/partials/footer/script-footer-custom.html

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
{{ end -}}
1313
*/}}
1414

15+
{{/* Mermaid diagrams */}}
16+
{{ if .Page.Store.Get "hasMermaid" }}
17+
<script type="module">
18+
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
19+
mermaid.initialize({ startOnLoad: true });
20+
</script>
21+
{{ end }}
22+
1523
{{/* Algolia DocSearch */}}
1624
{{ if site.Params.add_ons.docSearch -}}
1725
{{ partial "footer/esbuild" (dict "src" "js/docsearch.js" "load" "async" "transpile" false) -}}

resources/_gen/getresource/15350315646381278250

Lines changed: 0 additions & 12 deletions
This file was deleted.

0 commit comments

Comments
 (0)