Renders mermaid code blocks in the chat as diagrams in place (flowchart, sequence, class, state, ER, gantt, pie), with zoom, source toggle, copy PNG and SVG download.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:zhangTELL/dsh-diagram
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
DSH 图表插件:让 DSH 在审查代码、分析架构时直接在回复里写 mermaid 代码块,Web 界面将其原位渲染成示意图(流程图 / 时序图 / 类图 / 状态图 / ER 图 / 甘特图 / 饼图),辅助理解。
工作方式
- Agent 侧:宿主半边向每个 agent 的系统提示词注入「画图规范」——审查代码 / 梳理调用链 / 解释数据流与请求时序时,主动用
```mermaid代码块画图,并约束纵向单列布局保证可读性。 - 浏览器侧:client 半边用 MutationObserver 扫描聊天里的
.md-code-block代码块,块首行匹配flowchart/graph/sequenceDiagram/classDiagram/stateDiagram/erDiagram/gantt/pie的,在源码稳定 700ms 后渲染成 SVG 原位替换;工具条支持 放大(拖拽平移、双击复位)⇄ 查看源码切换 / 复制源码 / 复制 PNG(2x,剪贴板失败退化为下载) / 下载 SVG。 - mermaid 运行时:不打包进 client.js(体积 ~3.5MB),由宿主路由
/dsh-diagram/mermaid.min.js从插件依赖树内按需分发,首次遇到 mermaid 块时<script>加载,本地闭环不走 CDN。 - 渲染失败不吞内容:保留源码并显示错误条,模型可自行修正语法;跟随界面明暗主题;flowchart 使用纯 SVG 文本标签(
htmlLabels:false)保证 PNG 导出可靠。
安装
dsh plugin --profile web add github:zhangTELL/dsh-diagram
# 重启 dsh web / DSH Desktop 后生效
从源码构建:
git clone https://github.com/zhangTELL/dsh-diagram.git
cd dsh-diagram
pnpm install
pnpm build
dsh plugin --profile web add link:"$PWD"
结构
src/index.ts 宿主:systemPrompt 公告 + mermaid.min.js 路由
src/client/index.ts 浏览器:代码块扫描 / 渲染 / 工具条 / 主题 / 放大弹层
src/client/SettingsSection.tsx 应用设置「图表」分区(介绍 + 自动渲染开关)
src/client/prefs.ts 浏览器侧偏好(自动渲染开关,localStorage)
lib/ tsdown 产物(index.js 宿主 / client.js 浏览器闭包)
应用「设置 → 图表」栏目提供插件介绍、支持的图型说明和「自动渲染聊天中的 mermaid 代码块」开关(关闭后新消息的 mermaid 块保持源码显示)。
其他 mermaid 图型(mindmap / timeline 等)当前不支持渲染,只显示源码;如需扩展,把图型关键字加进 src/client/index.ts 的 SUBSET_RE 并同步更新宿主公告。
Links
More in this category
zhu1090093659/dsh-web#packages/dsh-task-board★ 9673
Task board for the dsh web GUI: a sidebar multi-column kanban whose cards run in real DSH agent sessions and can also be scheduled with cron expressions, executed host-side even with the browser closed.
zhu1090093659/dsh-web#packages/dsh-web-all★ 9673
Plugin and skin collection for the DSH Web UI: task board, Git graph, right-side panel, remote mobile UI, pet, live token stats, and a skin center.
MeteorNOX/DeepSeek-Balance-Whale-Widget★ 6324
A fixed-corner whale widget for the DSH web GUI — balance, today's usage and per-turn cost with peak/off-peak pricing, editable balance-alert and daily-budget bubbles, a module-based custom bubble queue with A/B weighted choices and random lines or images, 30+ vendor templates (OpenAI, OpenRouter, Kimi, SiliconFlow, Ark, Zhipu, MiniMax and more) with per-model balance and subscription quota, plus task-end sound, imported audio, custom roles and a resource manager. Local-only, no telemetry.
ccch1mneyyy/dsh-TUI★ 6018
Claude Code-style full-screen terminal UI: pixel-whale header, live status line, and streaming thought expansion.
omdsh-dev/DSH-better-sidebar★ 4645
Full sidebar workbench with file rendering and editing, terminal, Git, and subagents; third-party plugins can register new tabs.
Devin-AXIS/deepseek-design#deepseek-idesign★ 1607
Visual design studio for websites, app prototypes, posters, cards, reports, and magazines, with templates, direct element editing, selection-aware AI draft handoff, and export.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.