'use client'; import ReactMarkdown from 'react-markdown'; import remarkGfm from 'remark-gfm'; import type { Components } from 'react-markdown'; interface MarkdownMessageProps { content: string; variant?: 'user' | 'assistant'; } export default function MarkdownMessage({ content, variant = 'assistant' }: MarkdownMessageProps) { const isUser = variant === 'user'; const components: Components = { // Headings h1: ({ children }) => (
{children}
), // Strong/Bold - for scripture references strong: ({ children }) => ( {children} ), // Emphasis/Italic em: ({ children }) => ( {children} ), // Links a: ({ href, children }) => ( {children} ), // Lists ul: ({ children }) => ({children}), // Code blocks code: ({ className, children }) => { const isInline = !className; if (isInline) { return (
{children}
);
}
return (
{children}
);
},
// Pre for code blocks
pre: ({ children }) => (
{children}
),
// Horizontal rule
hr: () => (