diff --git a/src/_config/plugins/markdown.js b/src/_config/plugins/markdown.js index 921f939..7317208 100644 --- a/src/_config/plugins/markdown.js +++ b/src/_config/plugins/markdown.js @@ -53,7 +53,16 @@ export const markdownLib = markdownIt({ const src = token.attrGet('src'); const alt = token.content || ''; const caption = token.attrGet('title'); - const imgTag = `${alt}`; + + // Collect attributes + const attributes = token.attrs || []; + const hasEleventyWidths = attributes.some(([key]) => key === 'eleventy:widths'); + if (!hasEleventyWidths) { + attributes.push(['eleventy:widths', '650,960,1200']); + } + + const attributesString = attributes.map(([key, value]) => `${key}="${value}"`).join(' '); + const imgTag = `${alt}`; return caption ? `
${imgTag}
${caption}
` : imgTag; }; });