From 951151836521ee74c72db578556e6c52ffbfc2cf Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 29 Sep 2026 14:18:10 +0000 Subject: [PATCH] =?UTF-8?q?chore(mdx):=20=E6=98=BE=E5=BC=8F=E8=B1=81?= =?UTF-8?q?=E5=85=8D=20no-img-element=EF=BC=8C=E6=96=87=E6=A1=A3=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E6=94=B9=E4=B8=BA=E6=87=92=E5=8A=A0=E8=BD=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit images.unoptimized=true 下 next/image 不做任何优化,且外链图片缺 width/height 会运行时报错,保留原生 (与仓库其余 5 处一致用 eslint-disable-next-line)。同时加 loading="lazy" / decoding="async", 首屏外图片延迟加载以减少带宽;props 在后展开,个别图片仍可覆盖。 Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_014zBGrQgQnx1eLA9jQfSJWD --- mdx-components.tsx | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/mdx-components.tsx b/mdx-components.tsx index 4f6f781a..1ecd9473 100644 --- a/mdx-components.tsx +++ b/mdx-components.tsx @@ -37,7 +37,17 @@ export function getMDXComponents(components?: MDXComponents): MDXComponents { src && typeof src === "object" && "src" in src ? (src as { src: string }).src : src; - return {props.alt; + return ( + // images.unoptimized=true,next/image 不会带来优化,见文件头注释 + // eslint-disable-next-line @next/next/no-img-element + {props.alt + ); }, ...components, };