From 0f93e64a0833c66cc2dc9761c28514fb8043106b Mon Sep 17 00:00:00 2001 From: Antoine BERNIER Date: Thu, 29 Aug 2024 10:41:31 +0200 Subject: [PATCH] fix: Math.round img dimension --- src/components/mdx/Img/Img.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/mdx/Img/Img.tsx b/src/components/mdx/Img/Img.tsx index e3c6e418..db20aa1f 100644 --- a/src/components/mdx/Img/Img.tsx +++ b/src/components/mdx/Img/Img.tsx @@ -27,8 +27,8 @@ export async function Img({ const ratio = w && h ? w / h : undefined // If only one dimension is provided, calculate the other based on the image's aspect ratio - dims.width ??= height && ratio ? Number(height) * ratio : w - dims.height ??= width && ratio ? Number(width) / ratio : h + dims.width ??= height && ratio ? Math.round(Number(height) * ratio) : w + dims.height ??= width && ratio ? Math.round(Number(width) / ratio) : h } return (