import React from 'react'; import ReactMarkdown from 'react-markdown'; import rehypeKatex from 'rehype-katex'; import rehypeHighlight from 'rehype-highlight'; import remarkMath from 'remark-math'; import remarkGfm from 'remark-gfm'; import CodeBlock from './CodeBlock'; import { langSubset } from '~/utils/languages'; const Content = React.memo(({ content }) => { return ( <> {content} ); }); const code = React.memo((props) => { const { inline, className, children } = props; const match = /language-(\w+)/.exec(className || ''); const lang = match && match[1]; if (inline) { return {children}; } else { return ( ); } }); const p = React.memo((props) => { return {props?.children}; }); const blinker = ({ node }) => { if (node.type === 'text' && node.value === '█') { return {node.value}; } return null; }; const em = React.memo(({ node, ...props }) => { if ( props.children[0] && typeof props.children[0] === 'string' && props.children[0].startsWith('^') ) { return {props.children[0].substring(1)}; } if ( props.children[0] && typeof props.children[0] === 'string' && props.children[0].startsWith('~') ) { return {props.children[0].substring(1)}; } return ; }); export default Content;