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", "build": "next build",
"dev": "next dev", "dev": "next dev",
"start": "next start", "start": "next start",
"postinstall": "fumadocs-mdx" "postinstall": "fumadocs-mdx",
"lint": "next lint"
}, },
"dependencies": { "dependencies": {
"@theguild/remark-mermaid": "^0.3.0", "@theguild/remark-mermaid": "^0.3.0",

View file

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