Skip to content

Commit d3d1b8e

Browse files
committed
Updated img component and added lint script
1 parent af0f620 commit d3d1b8e

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
"build": "next build",
77
"dev": "next dev",
88
"start": "next start",
9-
"postinstall": "fumadocs-mdx"
9+
"postinstall": "fumadocs-mdx",
10+
"lint": "next lint"
1011
},
1112
"dependencies": {
1213
"@theguild/remark-mermaid": "^0.3.0",

src/app/(docs)/[[...slug]]/page.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ export default async function Page(props: {
2929
components={{
3030
...defaultMdxComponents,
3131
a: createRelativeLink(source, page),
32-
img: (props: React.ImgHTMLAttributes<HTMLImageElement>) => (
33-
<ImageZoom {...props} />
34-
),
32+
img: (props: React.ImgHTMLAttributes<HTMLImageElement>) => {
33+
const { src, ...rest } = props;
34+
if (typeof src !== "string") return null;
35+
return <ImageZoom src={src} {...rest} />;
36+
},
3537
pre: (props) => (
3638
<CodeBlock {...props}>
3739
<Pre>{props.children}</Pre>

0 commit comments

Comments
 (0)