dsh-mermaid-pele: Rendering Mermaid Diagrams in DSH Chat

Introduction

DeepSeek Harness (DSH) renders assistant replies as Markdown, but by default displays mermaid code blocks as plain text, requiring developers to view diagrams in a sidebar or external tool. This adds an extra step, and frequent context switching can disrupt the thought flow.

The dsh-mermaid-pele plugin hooks a rendering layer onto DSH’s conversation.chat.markdown.fence slot: any code block marked as mermaid is passed to the Pele engine and rendered as inline SVG, displayed directly in the chat stream. It relies on the Pele renderer used by Obsidian rather than the generic mermaid.js, making it smaller in size with no runtime dependencies.

Plugin Overview

  • Plugin name: dsh-mermaid-pele
  • Maintainer: Tazio7
  • Category: Client-side
  • Core value: Zero configuration, zero build, zero network — automatically renders Mermaid code blocks as inline SVG without disrupting the chat flow.

Installation & Activation

Installation steps are taken from the README:

  1. Clone the plugin into the profile’s plugin directory (default layout is <workspace>/plugins/):
git clone https://github.com/Tazio7/dsh-mermaid-pele.git \
  <your-workspace>/plugins/dsh-mermaid-pele
  1. Register the plugin to the profile:
dsh plugin --profile <profile-name> add <path-to>/dsh-mermaid-pele
  1. Restart DSH / open a new session, then type a mermaid code block in the chat to see the rendered result.

The plugin requires no configuration; the config object is empty.

Typical Usage

Paste the following in the chat:

```mermaid
flowchart LR
  A[Request occurs] --> B{Confirm order?}
  B -- yes --> C[Order placed]
  B -- no --> A
  C --> D[Closed loop + audit log]
```

After rendering, the code block becomes a flowchart that flows naturally with the surrounding text. The supported Mermaid syntax comes from Pele 1.13.0, corresponding to the syntax surface of Mermaid 12.1.0: flowchart, sequence, class, state, ER, gantt, pie, mindmap, timeline, treemap, and more. Syntax that Pele cannot parse will fall back to a plain code block.

Use Cases

  • Conversational flows that require “seeing the diagram”: e.g., design flows, state machines, sequence diagrams — rendered directly in the chat.
  • Scenarios that call for “zero extra tools”: no need to open external tools or switch windows.
  • Performance-sensitive environments: the plugin has no build step, no runtime network requests — just a single load and render.

Considerations

  • The plugin depends on DSH’s conversation.chat.markdown.fence slot. Currently tested and working on 0.2.2-rc.5. Other DSH versions with this slot should work in theory.
  • The plugin runs with the permissions of the current DSH process. Review the source code and license (MIT) before installing.
  • Not applicable to terminal CLI (no chat UI). User message bubbles and the Composer input are also not supported in the current version.

Security & Limitations

  • Model output is treated as untrusted input. The rendering path has three independent layers of defense:
  • Pele itself is a declarative syntax-to-SVG renderer and cannot execute code.
  • The rendered SVG undergoes sanitization: script, foreignObject, iframe, object, embed, image, and use elements are removed, along with on* event attributes, and javascript:, vbscript:, and data: URLs are filtered out.
  • Source code exceeding 32,768 characters will not be rendered and will be displayed as plain source instead.
  • The plugin stores no data, sends no telemetry, and makes no outbound requests.

Summary

dsh-mermaid-pele integrates Mermaid rendering into the DSH chat stream, leveraging Obsidian’s Pele engine for rendering capability. Zero configuration, zero network, zero build — with graceful fallback to a code block on failure. If you frequently use Mermaid diagrams in DSH, this plugin can save you the step of manually switching between tools.

  • Directory page: https://www.skillhub.cn/plugins/Tazio7/dsh-mermaid-pele
  • GitHub: https://github.com/Tazio7/dsh-mermaid-pele
羽毛球分组比赛记分
小程序二维码

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

Xiaoye