From 0a8e8f2ac5fc391c44c828dc94514683e89bea0d Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armand.philippot.eu>
Date: Thu, 11 Apr 2024 13:45:57 +0200
Subject: [PATCH] chore(mdx): add a comment to explain the hard coded
 attributes

---
 packages/integrations/mdx/src/rehype-images-to-component.ts | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/packages/integrations/mdx/src/rehype-images-to-component.ts b/packages/integrations/mdx/src/rehype-images-to-component.ts
index abcf73394b9b7..6c797fda235fc 100644
--- a/packages/integrations/mdx/src/rehype-images-to-component.ts
+++ b/packages/integrations/mdx/src/rehype-images-to-component.ts
@@ -52,6 +52,11 @@ function getImageComponentAttributes(props: Properties): MdxJsxAttribute[] {
 	for (const [prop, value] of Object.entries(props)) {
 		if (prop === 'src') continue;
 
+		/*
+		 * <Image /> component expects an array for those attributes but the
+		 * received properties are sanitized as strings. So we need to convert them
+		 * back to an array.
+		 */
 		if (prop === 'widths' || prop === 'densities') {
 			attrs.push(createArrayAttribute(prop, String(value).split(' ')));
 		} else {