import Markdown from 'react-markdown'
import remarkGfm from 'remark-gfm'
export function ResearchMarkdown({
text,
onNavigateCitation,
}: {
text: string
onNavigateCitation?: (url: string) => boolean
}) {
return (
{children}
,
h2: ({ children }) => {children}
,
h3: ({ children }) => {children}
,
h4: ({ children }) => {children}
,
h5: ({ children }) => {children}
,
h6: ({ children }) => {children}
,
a: ({ href, children, title }) => (
{
if (
href &&
event.button === 0 &&
!event.ctrlKey &&
!event.metaKey &&
!event.shiftKey &&
!event.altKey &&
onNavigateCitation?.(href)
)
event.preventDefault()
}}
>
{children}
),
img: ({ src, alt }) =>
typeof src === 'string' && src ? (
{alt || '画像を開く'}
) : (
{alt || '画像'}
),
table: ({ children }) => (
),
}}
>
{text}
)
}