paragraph.tsx
1021 Bytes
/**
* @fileoverview Paragraph component for rendering <p> tags in Markdown.
* Extracted from the main markdown renderer for modularity.
* Handles special rendering for paragraphs that directly contain an image.
*/
import React from 'react'
import ImageGallery from '@/app/components/base/image-gallery'
const Paragraph = (paragraph: any) => {
const { node,children }: any = paragraph
const children_node = node.children
if (children_node && children_node[0] && 'tagName' in children_node[0] && children_node[0].tagName === 'img') {
return (
<div className="markdown-img-wrapper">
<ImageGallery srcs={[children_node[0].properties.src]} />
{
Array.isArray(children) && children.length > 1 && (
<div className="mt-2">{children.slice(1)}</div>
)
}
</div>
)
}
// if(node.properties.dataDisable==='disable'){
// return <div className="practice-tags">{children}</div>
// }
return <div>{children}</div>
}
export default Paragraph