Introduction¶
In the DeepSeek Harness (DSH) Web chat interface, fenced code blocks in Markdown are usually displayed as plain text. For scenarios such as flowcharts and sequence diagrams, directly viewing the code or manually taking screenshots is less efficient. The dsh-web-mermaid plugin solves this problem: after a conversation ends, it automatically renders Mermaid code into interactive SVG diagrams.
Plugin Introduction¶
dsh-web-mermaid is a DeepSeek Harness Web plugin maintained by vtxf and released under the MIT License. It operates as a pure plugin without modifying the DSH core source code, and is primarily responsible for automatically converting ```mermaid code blocks in chat messages into SVG diagrams.
Installation and Activation¶
Installation can be completed using the official DSH plugin command:
dsh plugin --profile web add dsh-web-mermaid
After installation or uninstallation, restart dsh web for the changes to take effect.
Core Features¶
- Automatic Rendering: Mermaid fenced blocks in assistant replies are automatically rendered into interactive SVG diagrams after the message ends (no rendering occurs during streaming, to avoid partial rendering).
- Error Handling: If rendering fails (due to syntax errors or missing resources), the plugin keeps the original code block and displays an error message with a “Retry” button. Syntax errors are not rendered as error SVGs that cannot be dismissed.
- Theme Following: When switching between light and dark themes, already rendered diagrams are automatically re-rendered to adapt to the new theme.
- Zero Intrusion: The plugin runs as a pure plugin and does not modify DSH core source code.
- Resource Customization: If
window.__DSH_MERMAID_ASSET__ = '...'is executed before the page loads, it can override the Mermaid resource URL (the default is same-origin routing).
Usage Example¶
No additional work is required. Just ask the assistant to output a Mermaid code block, and the diagram will appear after the message ends.
```mermaid
graph TD
A[开始] --> B{判断}
B -->|是| C[继续]
B -->|否| D[结束]
```
Notes¶
- User messages are not rendered: DSH currently processes user messages as plain text (not Markdown), so Mermaid rendering applies only to assistant messages. This is the current behavior of DSH, not a defect of this plugin.
- No rendering during streaming: Diagrams appear only after the message ends, to avoid partial rendering issues during streaming output.
- Initial load: Rendering the first diagram requires loading the built-in mermaid.min.js (about 3.4 MB); afterwards, the browser cache is used.
- Offline scope: Offline mode refers to the Mermaid runtime (bundled in the plugin). However, if diagram content references external images or links, whether network access is required is still determined by the content itself.
References¶
- Plugin directory: https://www.skillhub.cn/plugins/vtxf/dsh-web-mermaid
- GitHub repository: https://github.com/vtxf/dsh-web-mermaid