summaryrefslogtreecommitdiff
path: root/layouts/shortcodes
diff options
context:
space:
mode:
authorReorx <novoreorx@gmail.com>2022-07-01 11:47:10 +0800
committerReorx <novoreorx@gmail.com>2022-07-01 11:47:10 +0800
commit61452c190b57ed2c1246723e7fd1575ac4bf5a23 (patch)
tree322d4d3b695a6e364031462b9a380259a5fbfcd5 /layouts/shortcodes
parent3eaeb0f6c7db592c54384251e5a162452599854c (diff)
add figure-img-size shortcode
for controlling image size with <figure>
Diffstat (limited to 'layouts/shortcodes')
-rw-r--r--layouts/shortcodes/figure-img-size.html12
1 files changed, 12 insertions, 0 deletions
diff --git a/layouts/shortcodes/figure-img-size.html b/layouts/shortcodes/figure-img-size.html
new file mode 100644
index 0000000..62c9f20
--- /dev/null
+++ b/layouts/shortcodes/figure-img-size.html
@@ -0,0 +1,12 @@
+{{- $width := .Get 1 }}
+{{- $height := .Get 2 }}
+<figure class="center align-center">
+ <div class="image-size-control" style="
+{{- with $width }}max-width: {{ . }};{{ end -}}
+{{- with $height }}max-height: {{ . }};{{ end -}}
+">
+ {{ .Page.RenderString .Inner }}
+ </div>
+
+ <figcaption><p>{{ .Get 0 | markdownify }}</p></figcaption>
+</figure>