@@ -144,55 +144,6 @@ const mdxComponents = {
144144 const src = typeof props . src === 'object' && props . src !== null && 'src' in props . src ? props . src . src : props . src ;
145145
146146 // Skip using ImageZoom for SVG, data URLs, img.shields.io, and if no src
147- if (
148- ! src ||
149- ( typeof src === 'string' && (
150- src . endsWith ( ".svg" ) ||
151- src . startsWith ( "data:" ) ||
152- src . includes ( "img.shields.io" )
153- ) )
154- ) {
155- // If props.src is an object (static import), pass it to next/image, otherwise standard img
156- if ( typeof props . src === 'object' ) {
157- // We can't use standard <img> for object src,
158- // but if we are skipping ImageZoom, we likely want raw <img> behavior?
159- // Actually, if it's an object, it's likely a standard image format (png/jpg)
160- // that we might want to Zoom, unless explicit opt-out?
161- // But if we are here, strict check failed.
162- // Wait, if it's an object, src.endsWith('.svg') is false (since src is contents).
163- // So we proceed to ImageZoom below.
164- } else {
165- return < img { ...props } /> ;
166- }
167- }
168-
169- // If it's a static import (object), we proceed to use ImageZoom.
170- // ImageZoom from fumadocs-ui handles static imports?
171- // Let's assume yes. Or fallback to Next.js Image.
172-
173- // ...
174- // Wait, the original code had:
175- /*
176- if (
177- !props.src ||
178- props.src.endsWith(".svg") || ...
179- ) { return <img ... /> }
180- */
181-
182- // With my new check:
183- /*
184- const src = ...
185- if (!src || (typeof src === 'string' && (...))) {
186- return <img {...props} />;
187- }
188- */
189-
190- // If props.src is object: src is string (url).
191- // If url ends with .svg, we enter block.
192- // <img src={object} /> is INVALID in HTML.
193- // <img src={object.src} /> is valid.
194-
195- // So distinct handling is needed.
196147
197148 if (
198149 ! src ||
@@ -202,11 +153,11 @@ const mdxComponents = {
202153 src . includes ( "img.shields.io" )
203154 ) )
204155 ) {
205- if ( typeof props . src === 'object' ) {
206- return < img { ...props } src = { src } /> ;
207- }
208- return < img { ...props } /> ;
209- }
156+ if ( typeof props . src === 'object' ) {
157+ return < img { ...props } src = { src } /> ;
158+ }
159+ return < img { ...props } /> ;
160+ }
210161
211162 const defaultHeight = 300 ;
212163 const defaultWidth = 700 ;
@@ -222,15 +173,10 @@ const mdxComponents = {
222173 : parseInt ( props . height ) || defaultHeight
223174 : defaultHeight ;
224175
225- // Prepend NEXT_PUBLIC_BASE_PATH for local public images (src starts with /).
226- // Next.js does NOT automatically prepend basePath to plain <img> or ImageZoom src strings —
227- // only its own <Image> component gets that treatment. Since fetch-docs writes
228- // <img src="/filaletter/..." /> with absolute paths, we must add the prefix here.
229- const basePath = process . env . NEXT_PUBLIC_BASE_PATH || "" ;
230- let url : string =
231- typeof src === "string" && src . startsWith ( "/" ) && ! src . startsWith ( "//" )
232- ? basePath + src
233- : ( src as string ) ;
176+ // Next.js <Image> (used by ImageZoom) automatically prepends basePath to local paths,
177+ // so we pass src directly — no manual basePath prefix needed here.
178+ // (assetPrefix only applies to webpack JS/CSS bundles, not public/ static files.)
179+ const url : string = src as string ;
234180
235181 return (
236182 < ImageZoom
0 commit comments