From 14ebcdecf31b1480ae997a0ab4d68207d31e083c Mon Sep 17 00:00:00 2001 From: Kian Kasad Date: Sun, 21 Feb 2021 21:54:43 -0800 Subject: [PATCH] Add 'align' option to figure shortcode (#256) Usage: {{< figure align=center src="image.jpg" >}} Parameter values: - 'center': align image and captions to center of page - anything else neglected * Appends "#center" to the image's URL in order to utilize existing CSS rules for centering images. --- assets/css/post-single.css | 4 ++++ layouts/shortcodes/figure.html | 7 +++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/assets/css/post-single.css b/assets/css/post-single.css index b7ec47fe..16a6c12e 100644 --- a/assets/css/post-single.css +++ b/assets/css/post-single.css @@ -242,6 +242,10 @@ margin: auto } +.post-content figure.align-center { + text-align: center; +} + .post-content figure > figcaption { color: var(--primary); font-size: 16px; diff --git a/layouts/shortcodes/figure.html b/layouts/shortcodes/figure.html index 71aebb15..77f188ea 100644 --- a/layouts/shortcodes/figure.html +++ b/layouts/shortcodes/figure.html @@ -1,8 +1,11 @@ - + {{- if .Get "link" -}} {{- end }} -