Files
jiang13-bbs/frontend/components/MarkdownBody.tsx
freefire 2056d6a3f9 feat(frontend): Markdown 支持 GFM、代码高亮与图片灯箱
统一 SSR/客户端渲染路径,评论与预览共用增强组件。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-16 05:41:25 +08:00

22 lines
633 B
TypeScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
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>;
}