From f3c98b3e4693519992e5d0dce50a35a0c5b1dd19 Mon Sep 17 00:00:00 2001 From: Balakrishnan Balasubramanian Date: Fri, 5 Jul 2024 02:05:55 -0400 Subject: [PATCH] add shortcode for collapsable section --- content/pages/playground.md | 10 ++++++++++ layouts/shortcodes/details.html | 9 +++++++++ 2 files changed, 19 insertions(+) create mode 100644 layouts/shortcodes/details.html diff --git a/content/pages/playground.md b/content/pages/playground.md index 593bdf7..b8e3e66 100644 --- a/content/pages/playground.md +++ b/content/pages/playground.md @@ -10,3 +10,13 @@ asciinema: true {{< asciinema key="demo" >}} There should be a asciinema cast above! +{{< details title="Click to see sample json" >}} +```json +{ + "external_tracker_url": "https://github.com/caddyserver/caddy/issues", + "external_tracker_format": "https://github.com/caddyserver/caddy/issues/{index}", + "external_tracker_style": "numeric", + "external_tracker_regexp_pattern": "" +} +``` +{{< /details >}} diff --git a/layouts/shortcodes/details.html b/layouts/shortcodes/details.html new file mode 100644 index 0000000..c52126d --- /dev/null +++ b/layouts/shortcodes/details.html @@ -0,0 +1,9 @@ +{{- /* +Template comment syntax: https://hugo.d.balki.me/templates/introduction/#comments +collapsable section ref: https://stackoverflow.com/a/78475534 +*/ -}} + +
+ {{ .Get "title" | default "Click to expand" | markdownify }} +
{{ .Inner | markdownify }}
+