diff --git a/.changeset/large-lemons-explode.md b/.changeset/large-lemons-explode.md new file mode 100644 index 0000000000..ff5553ad06 --- /dev/null +++ b/.changeset/large-lemons-explode.md @@ -0,0 +1,5 @@ +--- +'nextra': patch +--- + +do not add `placeholder="blur"` on `.svg` static images diff --git a/examples/swr-site/pages/docs/advanced/future-image.en-US.mdx b/examples/swr-site/pages/docs/advanced/future-image.en-US.mdx index 0b209de411..98c5b1022c 100644 --- a/examples/swr-site/pages/docs/advanced/future-image.en-US.mdx +++ b/examples/swr-site/pages/docs/advanced/future-image.en-US.mdx @@ -1,3 +1,6 @@ -![](../../../public/favicon/android-chrome-512x512.png) +![](/swr-logo.svg) ![](/favicon/android-chrome-512x512.png) + +![](../../../public/favicon/android-chrome-512x512.png) + diff --git a/examples/swr-site/theme.config.tsx b/examples/swr-site/theme.config.tsx index 71e76585d3..ebc5a37d7a 100644 --- a/examples/swr-site/theme.config.tsx +++ b/examples/swr-site/theme.config.tsx @@ -1,9 +1,10 @@ /* eslint sort-keys: error */ import { useRouter } from "next/router"; +import { ComponentProps, ReactElement } from "react"; import { DocsThemeConfig, useConfig } from "nextra-theme-docs"; -const Logo = ({ height }) => ( - +const Logo = (props: ComponentProps<"svg">): ReactElement => ( + - + ( -
- - {title} -
- ), + titleComponent: ({ title, type }) => + type === "separator" ? ( +
+ + {title} +
+ ) : ( + <>{title} + ), }, titleSuffix() { const { locale } = useRouter(); diff --git a/packages/nextra/src/mdx-plugins/static-image.ts b/packages/nextra/src/mdx-plugins/static-image.ts index 8bd0a4463a..0e3d84123f 100644 --- a/packages/nextra/src/mdx-plugins/static-image.ts +++ b/packages/nextra/src/mdx-plugins/static-image.ts @@ -12,6 +12,7 @@ const getASTNodeImport = (name: string, from: string) => ({ data: { estree: { type: 'Program', + sourceType: 'module', body: [ { type: 'ImportDeclaration', @@ -27,8 +28,7 @@ const getASTNodeImport = (name: string, from: string) => ({ raw: `"${from}"` } } - ], - sourceType: 'module' + ] } } }) @@ -82,7 +82,7 @@ export const remarkStaticImage: Plugin< name: 'alt', value: node.alt }, - { + !url.endsWith('.svg') && { type: 'mdxJsxAttribute', name: 'placeholder', value: 'blur'