MaiBot/dashboard/src/components/ui/markdown.tsx

29 lines
609 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import { MarkdownRenderer } from '@/components/markdown-renderer'
interface MarkdownProps {
children: string
className?: string
}
/**
* Markdown 组件 - 用于渲染 Markdown 内容(支持 GFM 和 LaTeX
*
* @example
* ```tsx
* <Markdown>
* # 标题
* 这是一段 **加粗** 的文字
*
* 数学公式:$E = mc^2$
*
* 块级公式:
* $$
* \int_{-\infty}^{\infty} e^{-x^2} dx = \sqrt{\pi}
* $$
* </Markdown>
* ```
*/
export function Markdown({ children, className }: MarkdownProps) {
return <MarkdownRenderer content={children} className={className} />
}