From 421d988bfcc0b15726421f3c5fb4ea661ddb7ccb Mon Sep 17 00:00:00 2001 From: Joseph Liu Date: Thu, 15 Aug 2024 19:47:16 -0700 Subject: [PATCH] all: render mermaid diagrams client-side --- content/docs/reference/custom-interactions.md | 4 ++-- layouts/_default/_markup/render-codeblock-kroki.html | 7 ------- .../_default/_markup/render-codeblock-mermaid.html | 4 ++++ layouts/partials/footer/script-footer-custom.html | 8 ++++++++ resources/_gen/getresource/15350315646381278250 | 12 ------------ resources/_gen/getresource/1544453209307383551 | 12 ------------ 6 files changed, 14 insertions(+), 33 deletions(-) delete mode 100644 layouts/_default/_markup/render-codeblock-kroki.html create mode 100644 layouts/_default/_markup/render-codeblock-mermaid.html delete mode 100644 resources/_gen/getresource/15350315646381278250 delete mode 100644 resources/_gen/getresource/1544453209307383551 diff --git a/content/docs/reference/custom-interactions.md b/content/docs/reference/custom-interactions.md index 9aa5aff..52062c2 100644 --- a/content/docs/reference/custom-interactions.md +++ b/content/docs/reference/custom-interactions.md @@ -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 @@ -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 diff --git a/layouts/_default/_markup/render-codeblock-kroki.html b/layouts/_default/_markup/render-codeblock-kroki.html deleted file mode 100644 index 0594826..0000000 --- a/layouts/_default/_markup/render-codeblock-kroki.html +++ /dev/null @@ -1,7 +0,0 @@ -{{- /* - HOTFIX: override kroki rendering to unblock CI - TODO(jo3-l): fix this properly -*/ -}} -
-
{{ .Inner }}
-
diff --git a/layouts/_default/_markup/render-codeblock-mermaid.html b/layouts/_default/_markup/render-codeblock-mermaid.html new file mode 100644 index 0000000..1380dd8 --- /dev/null +++ b/layouts/_default/_markup/render-codeblock-mermaid.html @@ -0,0 +1,4 @@ +
+	{{- .Inner | safeHTML }}
+
+{{ .Page.Store.Set "hasMermaid" true }} diff --git a/layouts/partials/footer/script-footer-custom.html b/layouts/partials/footer/script-footer-custom.html index 7501eec..58aa330 100644 --- a/layouts/partials/footer/script-footer-custom.html +++ b/layouts/partials/footer/script-footer-custom.html @@ -12,6 +12,14 @@ {{ end -}} */}} +{{/* Mermaid diagrams */}} +{{ if .Page.Store.Get "hasMermaid" }} + +{{ end }} + {{/* Algolia DocSearch */}} {{ if site.Params.add_ons.docSearch -}} {{ partial "footer/esbuild" (dict "src" "js/docsearch.js" "load" "async" "transpile" false) -}} diff --git a/resources/_gen/getresource/15350315646381278250 b/resources/_gen/getresource/15350315646381278250 deleted file mode 100644 index 428a21e..0000000 --- a/resources/_gen/getresource/15350315646381278250 +++ /dev/null @@ -1,12 +0,0 @@ -HTTP/1.1 200 OK -Content-Length: 13527 -Cache-Control: public, max-age=432000 -Content-Type: image/svg+xml -Date: Sun, 04 Aug 2024 23:10:30 GMT -Etag: 10.9.0dtZChM2IlX7beIVpuwq4zm00 -Expires: Fri, 09 Aug 2024 23:10:30 GMT -Last-Modified: Sun, 31 Mar 2024 10:20:25 GMT -X-Etags-1: 10.9.0dtZChM2IlX7beIVpuwq4zm00 -X-Etags-2: 10.9.0dtZChM2IlX7beIVpuwq4zm00 - -
Components
Row 1
Button
Button
Button
Button
Row 2
Button
Button
Row 3
Select Menu
Row 4
Button
Button
Button
Row 5
Select Menu
\ No newline at end of file diff --git a/resources/_gen/getresource/1544453209307383551 b/resources/_gen/getresource/1544453209307383551 deleted file mode 100644 index 58b1ab9..0000000 --- a/resources/_gen/getresource/1544453209307383551 +++ /dev/null @@ -1,12 +0,0 @@ -HTTP/1.1 200 OK -Content-Length: 13908 -Cache-Control: public, max-age=432000 -Content-Type: image/svg+xml -Date: Sun, 04 Aug 2024 23:10:30 GMT -Etag: 10.9.0evPHt6e4YlidQAb1lOEdZW00 -Expires: Fri, 09 Aug 2024 23:10:30 GMT -Last-Modified: Sun, 31 Mar 2024 10:20:25 GMT -X-Etags-1: 10.9.0evPHt6e4YlidQAb1lOEdZW00 -X-Etags-2: 10.9.0evPHt6e4YlidQAb1lOEdZW00 - -
Button pressed
CC Triggered
Menu used
Modal submitted
Bot sends message response
Bot sends modal response
Bot updates message
Bot sends followups
\ No newline at end of file