From b85c387a9a751af346af81ecb942eeda77326798 Mon Sep 17 00:00:00 2001 From: Cassie Jones Date: Sun, 3 Nov 2019 16:17:02 -0500 Subject: [PATCH] Add aside shortcode --- .eleventy.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/.eleventy.js b/.eleventy.js index abcaf2e..2e50a75 100644 --- a/.eleventy.js +++ b/.eleventy.js @@ -14,6 +14,7 @@ module.exports = (eleventyConfig) => { eleventyConfig.addNunjucksShortcode("youtube", youtubeShortcode); eleventyConfig.addPairedNunjucksShortcode("tweet", tweetShortcode); + eleventyConfig.addPairedShortcode("aside", asideShortcode); eleventyConfig.addFilter("markdown", value => md.renderInline(value)); eleventyConfig.addFilter("groupby", groupbyFilter); @@ -61,9 +62,9 @@ function groupbyFilter(items, path) { return groupby(items, item => access(item, path)); } -function youtubeShortcode(items, inWidth, inHeight) { - const width = items.width || inWidth || 560; - const height = items.height || inHeight || 315; +function youtubeShortcode(items, inWidth = 560, inHeight = 315) { + const width = items.width || inWidth; + const height = items.height || inHeight; const allow = items.allow || "accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" const border = items.border || "0"; const video = items.video || items; @@ -88,3 +89,8 @@ function tweetShortcode(content, items) { `; } + +function asideShortcode(content, style='') { + const html = md.render(content); + return `
${html}
`; +} -- 2.47.0