dsh-mermaid: A Mermaid Diagram Plugin for DeepSeek Harness

Introduction

DeepSeek Harness (DSH) adopts a plugin architecture and aims to extend functionality through modular components. In model inference scenarios, generating flowcharts or architecture diagrams is a common requirement. However, the official DSH Markdown renderer does not provide extension slots for fenced code blocks, so Mermaid code hand-written by assistants cannot be rendered directly in conversations. The dsh-mermaid plugin bypasses upstream renderer limitations by providing a mermaid_render tool and a custom card rendering solution, enabling diagram generation and display.

What This Is

dsh-mermaid is a plugin maintained by Preference-cmd. It provides DSH with diagram generation capabilities, allowing the model to output diagrams through tool calls and keeping them displayed in the user interface as “in-conversation artifacts”.

Core Features

The plugin includes the following core components:

  • mermaid_render tool: located on the host side. This tool accepts a diagram source and an optional short title, returns the Mermaid code fence as-is, and persists the { source, title? } data to result metadata. On replay, the system redraws the diagram based on the same source. This tool does not depend on a parser or headless browser.
  • Transcript card: located on the browser side. The component first passes the diagram source to the client’s fence renderer; if the client does not support it, it uses the plugin’s built-in rendering engine. The SVG enters the page as a React element. The plugin configures securityLevel: 'strict', sanitizing output in strict security mode, discarding all on* attributes and javascript: URLs, and not using dangerouslySetInnerHTML.
  • End-of-turn artifact line: located on the browser side. Finalized diagrams remain displayed by title after the turn-closing message, allowing users to see the result directly without expanding the process stream.
  • Sidebar viewer: located on the browser side. After clicking “Open in View”, the diagram enters a large canvas mode in the right sidebar. Users can zoom with the mouse wheel and pan by dragging. Reopening a diagram from the same call focuses the same tab.

Installation and Activation

Install it using the official plugin management command:

dsh plugin --profile web add github:Preference-cmd/dsh-mermaid

After installation, restart that profile to activate the plugin.

Typical Usage

In the conversation, the model calls the mermaid_render tool to generate a diagram. The generated diagram automatically appears as an “in-conversation artifact” at the end of the turn. Users can click the diagram to open a zoomable large canvas in the right sidebar for viewing.

Applicable Scenarios and Notes

  • Applicable Scenarios: Model inference tasks that require the model to output flowcharts, sequence diagrams, or architecture diagrams.
  • Notes:
    • Mermaid fences hand-written by assistants cannot be rendered as diagrams by the upstream renderer; the plugin implements this functionality through the mermaid_render tool and a custom card.
    • The SVG engine sanitizes output under securityLevel: 'strict', discarding on* attributes and javascript: URLs.

Conclusion

dsh-mermaid adds diagram generation capabilities to DeepSeek Harness. By combining tool calls with a sidebar viewer, it compensates for the limitations of native Markdown rendering. For more details, see the GitHub repository or the skill directory.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye