MrmoLabs/dsh-mermaid

Render Mermaid code blocks as SVG diagrams in DeepSeek Harness Web, with diagram/code switching, streaming support, dark mode, strict security, and npm/GitHub installation.

项目介绍Project Overview

dsh-mermaid 是 DSH Web 插件,将 mermaid、mermaidjs、mmd 围栏代码块渲染为 SVG,并提供图表/代码切换、流式更新、暗色模式、全屏缩放平移与 SVG 导出,渲染失败自动回退源码。适合在对话中查看流程图等图表;它仅处理 <pre><code> 块,单图超 5 万字符或 2000 行会拒绝渲染,且 DSH 预览版可能变更接口。

dsh-mermaid is a DSH Web plugin that renders mermaid, mermaidjs, and mmd fenced code blocks as SVG diagrams, with Diagram/Code toggle, streaming support, dark mode, fullscreen zoom/pan, SVG export, and automatic code fallback on render failure. Use it when model responses contain flowcharts or other Mermaid diagrams. It only enhances <pre><code> blocks, rejects diagrams over 50,000 characters or 2,000 lines, and DSH preview changes may break compatibility.

或使用命令行安装(适合开发者)Or use CLI install (for developers)

命令行安装CLI Install

dsh plugin --profile web add -w dsh-mermaid

MrmoLabs/dsh-mermaid 加入你的 DSH 配置(web profile)即可启用。

READMEREADME

dsh-mermaid

简体中文 | English

Render Mermaid fenced code blocks in DeepSeek Harness Web as SVG diagrams with a Diagram / Code toggle. The plugin supports streaming responses, dark mode, fullscreen viewing, zoom and pan, SVG export, and automatic fallback to source code when rendering fails.

npm version

Features

  • Supports mermaid, mermaidjs, and mmd fenced code blocks
  • Works with the DSH/Shiki plain fallback, where code elements may not have a language class
  • Bundles the exact Mermaid 11.17.0 release and requires no runtime CDN
  • Loads the bundled Mermaid runtime from DSH only after the first Mermaid block is detected
  • Renders multiple diagrams through a serial queue and yields between renders to keep the page responsive
  • Uses Mermaid's securityLevel: strict
  • Opens rendered diagrams in a fullscreen viewer with zoom, pan, reset, and fit-to-window controls
  • Exports the rendered diagram as a standalone SVG file from the card's More menu
  • Enhances only <pre><code> blocks and ignores inline code
  • Prevents stale asynchronous renders from overwriting newer streaming content
  • Rejects individual diagrams over 50,000 characters or 2,000 lines before invoking Mermaid

Compatibility

Last verified with @deepseek-ai/dsh 0.1.0-rc.7 on 2026-08-24 using Node.js 22.23.2. DSH is currently a developer preview and may introduce compatibility-breaking changes; please open an issue if a newer DSH release changes its plugin loader or Markdown DOM.

Install

If dsh is available globally, install the stable npm release with:

dsh plugin --profile web add -w dsh-mermaid

Without a global dsh command, invoke DSH through npx:

npx.cmd --yes @deepseek-ai/dsh plugin --profile web add -w dsh-mermaid

DSH installs the package through pnpm, detects its dsh.bundle declaration, and automatically adds dsh-mermaid to the web profile bundle list. Restart DSH Web or refresh the page after installation.

Install the latest GitHub source

npx.cmd -y github:MrmoLabs/dsh-mermaid install

This runs the repository's dsh-mermaid installer, which asks DSH to install the GitHub source into the web profile. GitHub installation builds the package during installation. If pnpm reports that it blocked a build script, add the exact package key shown by pnpm to allowBuilds in the profile's pnpm-workspace.yaml, then run the command again. Prefer the npm release for normal use.

Update and uninstall

Update the npm release:

dsh plugin --profile web update -w dsh-mermaid

Uninstall:

dsh plugin --profile web remove -w dsh-mermaid

Restart DSH Web after updating or uninstalling.

Usage

Ask a model to output a Mermaid fenced code block:

```mermaid
flowchart LR
  A[Code] --> B[Diagram]
```

The code block receives Diagram / Code controls and opens in diagram view by default.

Develop from source

Node.js 22.19 or later is required.

npm.cmd install
npm.cmd run check
npm.cmd run build
dsh plugin --profile web add -w .

Build output is written to lib/. The lightweight client.js bootstrap is registered with the DSH client module loader as dsh-mermaid, while the bundled Mermaid runtime is served from the plugin's same-origin host route and loaded on demand. DSH resolves the relative installation path against the current plugin checkout.

For manual local development, the built package can also be copied to:

C:\Users\<username>\.dsh\profiles\web\node_modules\dsh-mermaid

Never commit the complete .dsh directory. It may contain conversations and credentials.

Release checks

npm.cmd run check
npm.cmd run build
npm.cmd pack --dry-run
git status --short
git diff --cached

License

MIT

上一个 Prev dsh-remote 下一个 Next dsh-login-gateway