'use client' import { memo } from 'react' import ReactMarkdown from 'react-markdown' import remarkGfm from 'remark-gfm' import remarkMath from 'remark-math' import rehypeKatex from 'rehype-katex' import rehypeRaw from 'rehype-raw' import 'katex/dist/katex.min.css' import { NoteChartFromCode } from './note-chart' interface MarkdownContentProps { content: string className?: string } export const MarkdownContent = memo(function MarkdownContent({ content, className }: MarkdownContentProps) { return (
( ), code({ node, inline, className, children, ...props }: any) { const match = /language-(\w+)/.exec(className || '') const language = match ? match[1] : '' // Chart code blocks if (language === 'chart') { return } // Other code blocks if (!inline && match) { return ( {children} ) } return ( {children} ) }, }} > {content}
) })