Introduction

In client plugin development for DeepSeek Harness (DSH), displaying Markdown content (such as READMEs, logs, and notes) is a common requirement. Directly using different Markdown parsing libraries can lead to inconsistent rendering results, and if handled improperly, HTML tags in Markdown may introduce security risks. dsh-md-view solves this problem by encapsulating Harness’ native MarkdownText pipeline into a client service, providing unified rendering capabilities.

What This Is

dsh-md-view is a plugin for DSH clients, maintained by joao-paulo-santos. It does not provide a standalone UI; instead, it injects the client service mdView, allowing other plugins to render Markdown safely.

This plugin is based on Harness’ MarkdownText primitive and integrates GitHub Flavored Markdown (GFM), mathematical formulas, footnotes, and code highlighting with a copy button using Shiki. It is also optimized for documentation scenarios, handling the resolution of relative links and images.

Core Features

  1. Unified Rendering Pipeline: Exposed through the client service mdView, ensuring that all plugins displaying Markdown use the same rendering logic.
  2. Markdown Extension Support: Supports GFM, mathematical formulas, and footnotes.
  3. Code Highlighting and Interaction: Uses Shiki for syntax highlighting; fenced code blocks and inline code are not transformed by default (the original text is preserved), but they are highlighted and given a copy button.
  4. Resource Resolution:
    • Raw <img> tags are rendered as real images.
    • Relative link and image targets in documentation are resolved into GitHub blob URLs or raw content hosts based on links.repo.
  5. Security:
    • The rendered output consists of React elements and contains only plain text nodes.
    • HTML tags in Markdown (such as <script>) are preserved as visible text and cannot inject HTML.

Installation and Activation

This plugin has no external dependencies. Before installation, ensure you have a DSH checkout directory and work under the target profile (for example, web).

mkdir -p ~/dsh-plugins && cd ~/dsh-plugins
git clone https://github.com/joao-paulo-santos/dsh-md-view.git

# 从 harness checkout 目录执行
pnpm dsh plugin --profile web add ~/dsh-plugins/dsh-md-view

# 验证 profile 配置是否正确组合
pnpm dsh --profile web --dump-config

After installation, restart Harness. Client plugins with the mdView service injected can then call the rendering capabilities.

Typical Usage

In client plugin code, access the rendering capabilities through ctx.mdView. links.repo is an optional setting used to resolve relative links; if it is not provided, relative links remain unchanged.

  1. Render a single Markdown document as a React element: Suitable for scenarios where you need to control the layout yourself.
// consumer client half, inject: ['mdView', ...]
return React.createElement('div', { className: 'mine' },
  ctx.mdView.render(markdownText, { links: { repo: 'owner/name' } })
)
  1. Create a self-contained document component: The component returned by the plugin includes complete Markdown styling and layout.
const Doc = ctx.mdView.component({ text: markdownText, links: { repo: 'owner/name' } })
return React.createElement(Doc, {})

Use Cases and Notes

  • Use Cases: Developers who need to safely render Markdown in DSH client plugins, especially in scenarios that display code, mathematical formulas, or footnotes.
  • Styling Management: This plugin installs a wrapper stylesheet once; plugin developers do not need to add extra CSS to control Markdown rendering styles.
  • Dependencies: No external dependencies; the host-side implementation is a stub and has no persistence features.
  • Ecosystem Compatibility: The dsh-workspace-history and dsh-wo-github plugins can optionally depend on this plugin to render log bodies and repository READMEs (falling back to plain text).
  • Permission Notice: The plugin runs with the permissions of the current DSH process. Review the source code before installation.

Short Conclusion

dsh-md-view provides a unified, secure, and feature-rich Markdown rendering solution within the DSH ecosystem. Through ctx.mdView, developers can easily display high-quality Markdown content in client plugins without worrying about HTML injection risks or inconsistent styling.