feat(*): 插件中心与模型协议 - 完善声明式协议运行时并增加功能开放控制
This commit is contained in:
27
web/src/pages/plugins/plugin-markdown.tsx
Normal file
27
web/src/pages/plugins/plugin-markdown.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
import ReactMarkdown from "react-markdown";
|
||||
import remarkGfm from "remark-gfm";
|
||||
|
||||
type PluginMarkdownProps = {
|
||||
source: string;
|
||||
className?: string;
|
||||
};
|
||||
|
||||
export function PluginMarkdown({ source, className = "" }: PluginMarkdownProps) {
|
||||
return (
|
||||
<div className={`plugin-markdown ${className}`.trim()}>
|
||||
<ReactMarkdown
|
||||
remarkPlugins={[remarkGfm]}
|
||||
components={{
|
||||
a: ({ children, href }) => <a href={href} target="_blank" rel="noreferrer">{children}</a>,
|
||||
table: ({ children }) => (
|
||||
<div className="plugin-markdown-table-wrap">
|
||||
<table>{children}</table>
|
||||
</div>
|
||||
),
|
||||
}}
|
||||
>
|
||||
{source}
|
||||
</ReactMarkdown>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user