We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents 39fa2e4 + 108a4c4 commit e7bb9b1Copy full SHA for e7bb9b1
src/components/MarkdownImage.tsx
@@ -1,3 +1,5 @@
1
+import { extname } from "path"
2
+
3
import { Flex } from "@chakra-ui/react"
4
5
import { Image, type ImageProps } from "@/components/Image"
@@ -34,6 +36,9 @@ const MarkdownImage = ({
34
36
imageHeight = CONTENT_IMAGES_MAX_WIDTH / imageAspectRatio
35
37
}
38
39
+ const fileExt = extname(transformedSrc).toLowerCase()
40
+ const isAnimated = [".gif", ".apng", ".webp"].includes(fileExt)
41
42
return (
43
// display the wrapper as a `span` to avoid dom nesting warnings as mdx
44
// sometimes wraps images in `p` tags
@@ -45,6 +50,7 @@ const MarkdownImage = ({
45
50
height={imageHeight}
46
51
loading="lazy"
47
52
src={transformedSrc}
53
+ unoptimized={isAnimated}
48
54
{...rest}
49
55
/>
56
</Link>
0 commit comments