dsh-markdown-bubble: DeepSeek Harness User Message Markdown Rendering Plugin

The design philosophy of DeepSeek Harness (DSH) is “Everything is a plugin”. By default, messages replied by the assistant go through the host’s complete Markdown rendering pipeline, while messages sent by users usually remain in the source code form with white-space: pre-wrap. This results in inconsistent message formatting in the conversation interface, requiring developers to perform additional parsing of Markdown syntax when reading or debugging.

dsh-markdown-bubble is a client-side plugin designed to connect user messages to the host’s identical Markdown rendering pipeline. It replaces the user and steering seats in conversation.chat.node via the official keyed slot mechanism, achieving formatted display of user messages while maintaining compatibility with host styles and action bars.

Core Features

  • Official Seat Replacement: Registers user and steering seats via ctx.slots.inject with a priority of -1. Upon deactivation or uninstallation, it immediately restores the host’s default rendering.
  • Host-Identical Rendering: Directly invokes MarkdownText from @deepseek-ai/dsh-client-ui-primitives to reuse parsers, syntax highlighting, table rendering, and KaTeX formula support, avoiding reinventing the wheel.
  • Quote Chip Preservation: Calls the host projection function projectUserText to split the returned content into chips and plain text, keeping chips clickable.
  • Action Bar and Third-Party Plugin Compatibility: Rebuilds time and copy buttons, retains _actions / _action class name suffixes and data-clock anchors, ensuring plugins like dsh-edit-turn and dsh-delete-turn work normally.
  • Attachment and Supplement Block Support: Images are routed through the official conversation.message.images seat; file cards, quote summaries, and JsonBlock supplement blocks remain consistent with the host.
  • Soft Break Preservation: Adds GFM two-space hard breaks only to continuation lines outside of fenced code blocks; bytes inside code blocks remain unchanged, and tables and indented code are unaffected.
  • Error Fallback: Rendering errors for a single message are caught by the error boundary and fall back to the host’s original projection, preventing the entire seat from being removed by the slot mechanism.
  • Bilingual Switching: Text reuses the host’s chat dictionary and switches automatically based on the system language.

Installation and Activation

The installation process relies on DSH’s plugin management commands. It takes effect immediately after installation without additional configuration.

dsh plugin --profile web add dsh-markdown-bubble

The installation command writes dependencies to the profile and appends them to dsh.profile.bundles. The host usually scans the new line and hot-mounts it immediately; if it does not take effect, simply restart the process and refresh the page.

Typical Usage

Send a message containing Markdown syntax, and it will be rendered according to the format within the bubble.

# Title

- List **Bold**
- Second item `inline code`

> Quote a line
```js
const a = 1

```

Notes and Limitations

  • Pending Bubbles Not Overridden: Local echoes and pending steering messages are drawn directly by the host’s PendingSubmissionBubble / PendingSteeringBubble, bypassing the chat-node seat and remaining as plain text.
  • Queue Preview Not Overridden: The one-line preview of queued messages and goal command lines remain plain text.
  • Inline Chip Trade-off: When a chip interrupts a consecutive paragraph, that paragraph is split into blocks on both sides of the chip. This is a common trade-off in similar implementations.
  • Skin Boundary: Skins that customize user bubble styles by directly targeting host CSS-module class names will not match this plugin’s bubbles, but theme tokens and .dshmb-* custom styles work normally.
  • Multiline Semantics: Single line breaks are rendered as hard breaks; consecutive spaces and Tabs outside code blocks will be collapsed by Markdown (except inside code blocks).
  • Compatibility: The plugin relies on the conversation.chat.node keyed slot, attributes like data-chat-flow-kind, and interfaces like MarkdownText / projectUserText. Tested and compatible with DSH 0.2.0-rc.1 (web profile, Chromium).

Summary

This plugin solves the rendering inconsistency between user and assistant messages in DSH by connecting user messages to the standard Markdown pipeline without modifying the host source code. It preserves the interactive capability of quote chips and remains compatible with existing action bars and third-party plugins. It is ready to use upon installation and is suitable for scenarios requiring direct viewing of formatted content within the conversation stream.

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

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

Xiaoye