diff --git a/.changeset/legal-facts-teach.md b/.changeset/legal-facts-teach.md new file mode 100644 index 000000000000..5fe2dff41818 --- /dev/null +++ b/.changeset/legal-facts-teach.md @@ -0,0 +1,5 @@ +--- +'astro': patch +--- + +Fixes a case where the toolbar audit would incorrectly flag images processed by Astro in content collections documents diff --git a/examples/blog/src/content/blog/markdown-style-guide.md b/examples/blog/src/content/blog/markdown-style-guide.md index 1c010bea8109..b7a4c9ea13fb 100644 --- a/examples/blog/src/content/blog/markdown-style-guide.md +++ b/examples/blog/src/content/blog/markdown-style-guide.md @@ -39,7 +39,7 @@ Itatur? Quiatae cullecum rem ent aut odis in re eossequodi nonsequ idebis ne sap ### Output -![blog placeholder](/blog-placeholder-about.jpg) +![blog placeholder](../../assets/blog-placeholder-about.jpg) ## Blockquotes diff --git a/packages/astro/src/content/runtime.ts b/packages/astro/src/content/runtime.ts index f669f17fe3c2..0e3607d3a2c6 100644 --- a/packages/astro/src/content/runtime.ts +++ b/packages/astro/src/content/runtime.ts @@ -700,6 +700,8 @@ async function updateImageReferencesInBody(html: string, fileName: string) { ...attributes, src: image.src, srcset: image.srcSet.attribute, + // This attribute is used by the toolbar audit + ...(import.meta.env.DEV ? { 'data-image-component': 'true' } : {}), }) .map(([key, value]) => (value ? `${key}="${escape(value)}"` : '')) .join(' ');