在 DSH 网络会话中将 Mermaid 代码围栏渲染为 SVG 图表
在 DSH 网络会话中将 Mermaid 代码围栏渲染为 SVG 图表。
项目简介
在 DSH Web 会话消息中把 sh dsh plugin --profile web add github:AKS1st/dsh-mermaid dsh web # 重启 web 服务使 profile 生效 sh npm install npm run build dsh plugin --profile web add . dsh web sh dsh plugin --profile web remove @dsh-external/dsh-mermaid yaml insert: id: mermaid name: '@dsh-external/dsh-mermaid' config: theme: auto maxTextSize: 50000 maxEdges: 2000 securityLevel: strict
配置项 · 默认值 · 说明 配置项: theme · 默认值: auto · 说明: 图表主题:auto(跟随亮/暗)、default、dark、neutral、forest、base 配置项: maxTextSize · 默认值: 50000 · 说明: 单图文本上限(防超大图拖垮渲染) 配置项: maxEdges · 默认值: 2000 · 说明: 边数守卫 配置项: securityLevel · 默认值: strict · 说明: 固定为 strict,不接受 loose
在 profile 的 cordis.patch.yml 里以 - set: 或 - update: 覆盖即可。 安全模型 助手输出不可信:securityLevel 锁定 strict,标签中的 HTML 由 mermaid 内部 DOMPurify 消毒;不调用 bindFunctions,点击处理保持惰性。 渲染失败时保留原纯文本代码块(绝不渲染错误 HTML),控制台可见错误。 已知限制 依赖主前端 CodeBlock 的稳定钩子(字面量类 md-code-block 与 infostring 文本);上游渲染器重构时需要同步更新选择器。 流式输出期间不渲染,定格后才渲染。 securityLevel: strict 下 mermaid 的点击交互不可用。