Updated img component and added lint script

This commit is contained in:
Jonas List 2025-04-14 22:25:19 +02:00
parent af0f6207d2
commit d3d1b8e56b
2 changed files with 7 additions and 4 deletions

View file

@ -6,7 +6,8 @@
"build": "next build",
"dev": "next dev",
"start": "next start",
"postinstall": "fumadocs-mdx"
"postinstall": "fumadocs-mdx",
"lint": "next lint"
},
"dependencies": {
"@theguild/remark-mermaid": "^0.3.0",

View file

@ -29,9 +29,11 @@ export default async function Page(props: {
components={{
...defaultMdxComponents,
a: createRelativeLink(source, page),
img: (props: React.ImgHTMLAttributes<HTMLImageElement>) => (
<ImageZoom {...props} />
),
img: (props: React.ImgHTMLAttributes<HTMLImageElement>) => {
const { src, ...rest } = props;
if (typeof src !== "string") return null;
return <ImageZoom src={src} {...rest} />;
},
pre: (props) => (
<CodeBlock {...props}>
<Pre>{props.children}</Pre>