feat(frontend): Markdown 支持 GFM、代码高亮与图片灯箱
统一 SSR/客户端渲染路径,评论与预览共用增强组件。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
16
frontend/components/markdown/mergeComponents.tsx
Normal file
16
frontend/components/markdown/mergeComponents.tsx
Normal file
@@ -0,0 +1,16 @@
|
||||
import type { Components } from "react-markdown";
|
||||
import MdImage from "./MdImage";
|
||||
import MdCodeBlock from "./MdCodeBlock";
|
||||
import MdLink from "./MdLink";
|
||||
|
||||
/** 默认自定义标签:图箱 / 代码块 / 外链;可被调用方浅合并覆盖 */
|
||||
export function mergeMarkdownComponents(
|
||||
overrides?: Components
|
||||
): Components {
|
||||
return {
|
||||
img: MdImage,
|
||||
pre: MdCodeBlock,
|
||||
a: MdLink,
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user