summaryrefslogtreecommitdiffstats
path: root/themes/danix-xyz-hacker/layouts/shortcodes/gallery.html
diff options
context:
space:
mode:
Diffstat (limited to 'themes/danix-xyz-hacker/layouts/shortcodes/gallery.html')
-rw-r--r--themes/danix-xyz-hacker/layouts/shortcodes/gallery.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/themes/danix-xyz-hacker/layouts/shortcodes/gallery.html b/themes/danix-xyz-hacker/layouts/shortcodes/gallery.html
new file mode 100644
index 0000000..b66c327
--- /dev/null
+++ b/themes/danix-xyz-hacker/layouts/shortcodes/gallery.html
@@ -0,0 +1,12 @@
+{{- $cols := .Get "cols" | default "2" -}}
+
+<div class="my-8 grid gap-4" style="grid-template-columns: repeat({{ $cols }}, 1fr)">
+ {{- range $line := strings.Split .Inner "\n" -}}
+ {{- if strings.Contains $line "![" -}}
+ {{- $image := strings.TrimSpace $line -}}
+ {{- if $image -}}
+ {{ $image | markdownify | safeHTML }}
+ {{- end -}}
+ {{- end -}}
+ {{- end -}}
+</div>