Skip to content

Commit

Permalink
all: render mermaid diagrams client-side
Browse files Browse the repository at this point in the history
  • Loading branch information
jo3-l committed Aug 16, 2024
1 parent d4a1272 commit 421d988
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 33 deletions.
4 changes: 2 additions & 2 deletions content/docs/reference/custom-interactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ An interaction's lifetime starts with the initial _interaction_ with an _interac
interaction.
4. _(optional)_ Continue to send followup responses for up to 15 minutes until the interaction token expires.

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

Below is an example of a `components` structure.

```kroki {type=mermaid}
```mermaid
graph TB
subgraph Components
subgraph Row 1
Expand Down
7 changes: 0 additions & 7 deletions layouts/_default/_markup/render-codeblock-kroki.html

This file was deleted.

4 changes: 4 additions & 0 deletions layouts/_default/_markup/render-codeblock-mermaid.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<pre class="mermaid">
{{- .Inner | safeHTML }}
</pre>
{{ .Page.Store.Set "hasMermaid" true }}
8 changes: 8 additions & 0 deletions layouts/partials/footer/script-footer-custom.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@
{{ end -}}
*/}}

{{/* Mermaid diagrams */}}
{{ if .Page.Store.Get "hasMermaid" }}
<script type="module">
import mermaid from 'https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.esm.min.mjs';
mermaid.initialize({ startOnLoad: true });
</script>
{{ end }}

{{/* Algolia DocSearch */}}
{{ if site.Params.add_ons.docSearch -}}
{{ partial "footer/esbuild" (dict "src" "js/docsearch.js" "load" "async" "transpile" false) -}}
Expand Down
12 changes: 0 additions & 12 deletions resources/_gen/getresource/15350315646381278250

This file was deleted.

Loading

0 comments on commit 421d988

Please sign in to comment.