@@ -168,8 +168,8 @@ const processMarkdownContent = (content: string): string => {
168168 processed = processed . replace (
169169 / : : : d e t a i l s \s + ( .* ?) \n ( [ \s \S ] * ?) : : : / gim,
170170 '\n\n<details class="my-4 border border-gray-200 rounded-lg overflow-hidden bg-white">' +
171- '<summary class="bg-gray-50 px-4 py-3 cursor-pointer font-medium text-gray-800 hover:bg-gray-100 transition-colors border-b border-gray-200">$1</summary>' +
172- '<div class="px-4 py-3 text-gray-700">$2</div></details>\n\n' ,
171+ '<summary class="bg-gray-50 px-4 py-3 cursor-pointer font-medium text-gray-800 hover:bg-gray-100 transition-colors border-b border-gray-200">$1</summary>' +
172+ '<div class="px-4 py-3 text-gray-700">$2</div></details>\n\n' ,
173173 ) ;
174174
175175 // GitHub-style alerts - ensure proper block separation
@@ -327,19 +327,19 @@ const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({
327327
328328 const createHeading =
329329 ( level : keyof typeof headingClasses ) =>
330- ( {
331- children,
332- ...props
333- } : React . HTMLAttributes < HTMLHeadingElement > & {
334- children ?: React . ReactNode ;
335- } ) => {
336- const Tag = level ;
337- return (
338- < Tag { ...props } className = { headingClasses [ level ] } >
339- { children }
340- </ Tag >
341- ) ;
342- } ;
330+ ( {
331+ children,
332+ ...props
333+ } : React . HTMLAttributes < HTMLHeadingElement > & {
334+ children ?: React . ReactNode ;
335+ } ) => {
336+ const Tag = level ;
337+ return (
338+ < Tag { ...props } className = { headingClasses [ level ] } >
339+ { children }
340+ </ Tag >
341+ ) ;
342+ } ;
343343
344344 const components : Components = {
345345 h1 : createHeading ( 'h1' ) ,
@@ -354,26 +354,44 @@ const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({
354354 const childArray = React . Children . toArray ( children ) ;
355355
356356 // Check if any child contains HTML that would create block elements or is an image
357- const hasProblematicContent = childArray . some ( child => {
357+ const hasProblematicContent = childArray . some ( ( child ) => {
358358 if ( typeof child === 'string' ) {
359359 // Check for HTML tags that create block elements
360- return / < ( d i v | f i g u r e | b l o c k q u o t e | p r e | t a b l e | u l | o l | d e t a i l s | i f r a m e | h [ 1 - 6 ] | i m g ) / i. test ( child ) ;
360+ return / < ( d i v | f i g u r e | b l o c k q u o t e | p r e | t a b l e | u l | o l | d e t a i l s | i f r a m e | h [ 1 - 6 ] | i m g ) / i. test (
361+ child ,
362+ ) ;
361363 }
362364 if ( React . isValidElement ( child ) ) {
363365 const type = child . type ;
364366 // Check for React components that render as block elements or images
365- return typeof type === 'string' &&
366- [ 'div' , 'figure' , 'blockquote' , 'pre' , 'table' , 'ul' , 'ol' , 'details' , 'iframe' , 'img' , 'span' ] . includes ( type ) ;
367+ return (
368+ typeof type === 'string' &&
369+ [
370+ 'div' ,
371+ 'figure' ,
372+ 'blockquote' ,
373+ 'pre' ,
374+ 'table' ,
375+ 'ul' ,
376+ 'ol' ,
377+ 'details' ,
378+ 'iframe' ,
379+ 'img' ,
380+ 'span' ,
381+ ] . includes ( type )
382+ ) ;
367383 }
368384 return false ;
369385 } ) ;
370386
371387 // Check if this paragraph only contains an image
372- const isImageOnly = childArray . length === 1 &&
388+ const isImageOnly =
389+ childArray . length === 1 &&
373390 React . isValidElement ( childArray [ 0 ] ) &&
374391 ( childArray [ 0 ] . type === 'img' ||
375392 ( typeof childArray [ 0 ] . type === 'function' &&
376- childArray [ 0 ] . props && typeof childArray [ 0 ] . props === 'object' &&
393+ childArray [ 0 ] . props &&
394+ typeof childArray [ 0 ] . props === 'object' &&
377395 'src' in childArray [ 0 ] . props ) ) ;
378396
379397 // If contains problematic content or is image-only, render as div
@@ -673,8 +691,6 @@ const MarkdownRenderer: React.FC<MarkdownRendererProps> = ({
673691 { children }
674692 </ summary >
675693 ) ,
676-
677-
678694 } ;
679695
680696 // Prevent hydration mismatch by only rendering on client
0 commit comments