import ReactMarkdown from 'react-markdown' import 'katex/dist/katex.min.css' import RemarkMath from 'remark-math' import RemarkBreaks from 'remark-breaks' import RehypeKatex from 'rehype-katex' import RemarkGfm from 'remark-gfm' import RehypeRaw from 'rehype-raw' import { flow } from 'lodash-es' import cn from '@/utils/classnames' import { preprocessLaTeX, preprocessThinkTag } from './markdown-utils' import { AudioBlock, CodeBlock, Img, Link, MarkdownButton, MarkdownForm, Paragraph, ScriptBlock, ThinkBlock, VideoBlock, } from '@/app/components/base/markdown-blocks' /** * @fileoverview Main Markdown rendering component. * This file was refactored to extract individual block renderers and utility functions * into separate modules for better organization and maintainability as of [Date of refactor]. * Further refactoring candidates (custom block components not fitting general categories) * are noted in their respective files if applicable. */ export function Markdown(props: { content: string; className?: string; customDisallowedElements?: string[] }) { const latexContent = flow([ preprocessThinkTag, preprocessLaTeX, ])(props.content) return (