Introduction

When processing Markdown output in DSH, the model might return a whole block of text, while users often only want to modify a few blocks, list items, or a single sentence. Sending natural language directly to the model often lacks the original text location and context.

dsh-md-annotator is used to annotate items one by one in the Markdown preview of dsh-better-sidebar, then organize the annotations into structured modification instructions and write them into the draft of the current session input box, facilitating subsequent sending to the model.

Overview

dsh-md-annotator is a DSH web plugin, positioned to annotate on the sidebar Markdown preview and convert annotations into modification instructions.

It depends on the DSH web profile and relies on the mounted dsh-better-sidebar. The repository account is 3361805598-gif, the author field in package.json is lawyer_cui; the license is MIT.

Core Features

Annotation Objects and Types

When opening a .md file, the plugin parses the document into blocks such as headings, paragraphs, list items, tables, code blocks, blockquotes, and horizontal rules. After hovering over a block or list item, inline annotations can be added, supporting additions, modifications, and deletions. Multiple annotations can be added to one location, and tags of types such as “Must Change”, “Suggested Change”, and “Question” can be applied.

You can also select arbitrary text within the same paragraph or list item to add a selection annotation. The selected text will remain highlighted, and the annotation reference is precise to the selected text.

Annotation Display and List

Annotated blocks will display an amber left border and a counter badge. The bottom fixed bar displays the total count and allows collapsing or expanding the annotation list.

The annotation list floating panel is draggable and resizable. It supports removing individual items, clearing all with one click, and clicking to jump to the location.

Sending Modification Instructions

After clicking “Send All”, the plugin writes structured instructions into the draft of the current session input box. Instructions are grouped by type, containing file path, line numbers, original text references, and annotations.

The list also supports sending items one by one, or sending multiple selected items at once.

Re-matching After Regeneration

After the file is regenerated, the plugin re-matches annotations based on block index and original text. Mismatched items will be marked as “Original text has changed”.

Settings and Backup

The sidebar settings page allows toggling this previewer entirely and configuring the automatic clearing of annotations and the prefix of the sent content after sending.

The list panel and bottom bar provide an export button to download all annotations of the current file as a JSON backup. Annotations are stored in browser memory: they are not lost when switching tabs or sessions, but will be cleared after restarting DSH or disabling the plugin.

Installation and Activation

First, confirm the prerequisites:

  • Node ≥ 20
  • pnpm ≥ 10
  • dsh web runs normally
  • dsh-better-sidebar is mounted

If dsh-better-sidebar is not mounted, the plugin will keep waiting for the service and will not activate.

Install Release Version

Download the v0.6.0 package and verify SHA-256:

curl -L -o dsh-md-annotator-0.6.0.tgz \
  https://github.com/3361805598-gif/dsh-md-annotator/releases/download/v0.6.0/dsh-md-annotator-0.6.0.tgz
shasum -a 256 dsh-md-annotator-0.6.0.tgz

The SHA-256 of the v0.6.0 package should be:

7e389c52e9ec65f6864b766fe39e586c67d5df80fa94fdd26cf7cfc18c9fff08

After placing the package into the vendor directory of the web profile, execute the installation:

mkdir -p ~/.dsh/profiles/web/vendor
cp dsh-md-annotator-0.6.0.tgz ~/.dsh/profiles/web/vendor/
dsh plugin --profile web add file:vendor/dsh-md-annotator-0.6.0.tgz

After installation, restart dsh web and then hard refresh in the browser; the shortcut key is Cmd/Ctrl+Shift+R.

Package from Source

Execute within the package directory:

pnpm pack
cp dist/dsh-md-annotator-<version>.tgz ~/.dsh/profiles/web/vendor/
dsh plugin --profile web add file:vendor/dsh-md-annotator-<version>.tgz

After completion, restart dsh web similarly and hard refresh in the browser.

Disable and Uninstall

When disabling temporarily, close the md-annotator entry in the sidebar card on the sidebar settings page. After disabling, the built-in Markdown preview of .md files will be restored.

Complete uninstall:

dsh plugin --profile web remove dsh-md-annotator

Then restart dsh web.

Typical Usage

  1. Open a .md file, hover over any block or list item in the preview, click “+ Annotate”, and fill in the modification opinion inline.

  2. Drag-select text within the same paragraph or list item in the preview, click “+ Annotate Selection”, and fill in the opinion.

  3. Click “Send All”, and the draft of the current session input box will be written with structured modification instructions; press Enter to send to the model.

  4. You can also send items one by one in the annotation list, or send multiple selected items at once.

  5. If you do not want to use it temporarily, close the md-annotator entry in the sidebar settings page.

Applicable Scenarios and Notes

This plugin is suitable for use in DSH web combined with dsh-better-sidebar, for scenarios that require organizing modification points in the Markdown preview into structured instructions and sending them to the model for processing.

Please note:

  • During plugin operation, it will take over the sidebar preview of .md files; the edit mode of the built-in preview will be unavailable; it will automatically recover after disabling.
  • The sidebar supports switching between preview and source code edit modes; source code editing supports Cmd/Ctrl+S or the host save button to write back to the original Markdown file.
  • Annotations are stored in browser memory and will not be written to the original Markdown file; they will be cleared after restarting DSH or disabling the plugin.
  • The UI is entirely in Chinese, without an i18n layer, positioning as a personal plugin.
  • The inline Markdown parser is a CommonMark subset and does not support setext headings, nested lists, inline HTML, code fences or blockquotes within list items, or pipe character escaping in table cells.
  • localStorage persistence and drag-and-drop sorting are future directions for evolution.

After installation and activation, the plugin runs within the DSH plugin system. Before installing, you should check the source code, dependencies, and MIT license; after activation, the plugin runs with the permissions of the current DSH process, and it is recommended to use it in trusted projects and repositories.

Links

Community Directory Page: https://www.skillhub.cn/plugins/3361805598-gif/dsh-md-annotator

GitHub: https://github.com/3361805598-gif/dsh-md-annotator