22 lines
633 B
TypeScript
22 lines
633 B
TypeScript
import type { Components } from "react-markdown";
|
||
import { renderMarkdownToReact } from "@/components/markdown/renderMarkdown";
|
||
|
||
type MarkdownBodyProps = {
|
||
content: string;
|
||
className?: string;
|
||
components?: Components;
|
||
};
|
||
|
||
/**
|
||
* 站点统一 Markdown 渲染(服务端):GFM + Shiki 双主题、图箱、代码块复制/折叠。
|
||
* 客户端预览请用 MarkdownBodyClient。
|
||
*/
|
||
export default async function MarkdownBody({
|
||
content,
|
||
className = "prose-content",
|
||
components,
|
||
}: MarkdownBodyProps) {
|
||
const tree = await renderMarkdownToReact(content, components);
|
||
return <div className={className}>{tree}</div>;
|
||
}
|