From 0c7462ea48ff2600a3bc5ba1cc6132c80deed73a Mon Sep 17 00:00:00 2001 From: Helen Chong <119173961+helenclx@users.noreply.github.com> Date: Wed, 31 Jul 2024 00:03:46 +0800 Subject: [PATCH] Add class name parameter to image figures --- src/_config/shortcodes.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/_config/shortcodes.js b/src/_config/shortcodes.js index 1c9a7f51..d983d403 100644 --- a/src/_config/shortcodes.js +++ b/src/_config/shortcodes.js @@ -21,9 +21,12 @@ export default function(eleventyConfig) { }); // Image figure and figcaption - eleventyConfig.addPairedShortcode('imgFigure', (caption, img, alt=caption, enableLazyLoading=true) => { + eleventyConfig.addPairedShortcode('imgFigure', ( + caption, img, alt=caption, className, enableLazyLoading=true + ) => { + const classMarkup = className ? ` class="${className}"` : ""; const figcaption = markdownLibrary.renderInline(caption); - return `
+ return ` ${alt}
${figcaption}
`;