DSH Plugins Marketplace

DSH Plugins

Plugins

/

Development & Infrastructure

/

dsh-md-live-edit

d

dsh-md-live-edit

Manifest valid

Edit Markdown right in the sidebar preview — click a block to edit it in place, ⌘/Ctrl+Enter writes it back to the file, and the built-in read-only view stays one menu pick away. Its HTTP routes have

UI (client)hasBundlePatch

@fanfan4589/dsh-md-live-edit

npm license tests

English | 中文

Edit Markdown files directly in the sidebar preview: click any rendered block, edit that block's Markdown source in place, and save the whole document back to disk. No code mode, no separate editor.

Three panels: click a block, edit it in place, save with ⌘↩

Scope: a small, restrained patch. It adds one preview implementation and one write route. It does not replace built-in slots or layout, does not change kernel behaviour, and does not touch other plugins' data. Turning it off returns the sidebar to the official read-only preview.

What it solves

The built-in sidebar preview is view-only (dsh-client-ui-sidebar-documentpreview documents "Preview, not editing"). To change a word you had to leave the rendered view, find a text editor, and lose the context of the surrounding document.

This plugin registers an extension-band Markdown preview with the same extensions (md, markdown). It ranks above the built-in renderer and is selected by default; the renderer dropdown still offers the built-in read-only Markdown, Code, and Plain text views at any time.

How to use

  1. Open any .md file in the right Sidebar (file tree, or Mod+P → files page).
  2. The document renders as blocks. The header shows the Markdown 可编辑 / Editable Markdown renderer, and the body carries a green 可编辑 chip.
  3. Click a block → it becomes a small editor holding that block's exact Markdown source. Everything else stays rendered.
  4. Press ⌘/Ctrl + Enter (or click Save) to write the document back. Esc / Cancel discards the edit for that block.
  5. The editor toolbar also inserts a block above or below, and deletes the block (an emptied block is deleted; a deletion collapses the blank line it leaves). A + Add block affordance sits at the end of the document.
  6. The header reports save state: saving / saved / failed (with retry). If the file changes elsewhere while you edit, a conflict banner lets you reload the disk version or keep yours.

Frontmatter (--- blocks) is editable like any other block.

Editing a table

A table block opens as its own Markdown table. Add a row by adding one line:

| Capability | Status | Note |
| --- | --- | --- |
| In-place edit | ✅ | click any block |
| Save | ✅ | ⌘↩ |

Save, and the rendered table updates.

Advantages

  • Stay in the rendered view. No mode switch, no full-document source view.
  • Source fidelity. Every block keeps its exact source lines; editing one block rebuilds the file byte-for-byte around it, so untouched formatting, frontmatter, and spacing survive.
  • Whole-document safety. Large files are completed page by page before editing is allowed, so a save can never write back only the first page.
  • Sandbox respected. Writes go through the composed fs with the session's own policy (sandboxPolicy.resolve({ session })); a read-only session is refused rather than widened.
  • Admission-gated route. The write route asks connection.requestRejection (Host/Origin fence + browser session) before it reads a body; a rejected request touches neither the body nor the filesystem.
  • Matches the host. Theme tokens only; bilingual (English / 中文); follows ctx.locale and switches live.

Limitations (honest)

  • Block source editing, not rich text. You edit the block's Markdown source (a table opens as a table). It is not a Word/Excel-style direct surface; there is no cell-by-cell table editing.
  • No new files, no renames. It edits the open file only; creating files and renaming stay in the files panel.
  • Rendering is a deliberate subset. ATX/Setext headings, fenced code, GFM tables, lists, blockquotes, rules, frontmatter; inline bold/italic/strike/code/ links/images. Nested lists render at one level, and math or nested-quote styling is not rendered — the source is still intact and editable.
  • Whole-file writes. A save rewrites the file; concurrent external writes are detected while you edit and surfaced as a conflict, but there is no per-line patch transport.
  • Version floor. Requires DSH >=0.2.2-rc.1 (the release line whose connection service exposes requestRejection). On an older Host the route fails closed with 401 rather than serving an unguarded write.
  • Save mode follows the session. In read-only sessions the preview is editable locally but the save is refused with the sandbox reason.

Capability matrix

AreaSupported
File types.md, .markdown
Block editingheadings, paragraphs, lists, blockquotes, fenced code, tables, rules, frontmatter
Inline renderingbold, italic, strikethrough, inline code, links, images
Block actionsedit, delete, insert above, insert below, append at end
Save⌘/Ctrl+Enter, Save button; whole document
Conflict handlingexternal-change banner, reload or keep
Rendererdefault; dropdown switches to built-in Markdown / Code / Plain text
LocalesEnglish, 中文

Install

Add the local directory

git clone https://github.com/feifandiv/dsh-md-live-edit.git

Then add it as a bundle in DSH (Settings → Plugins → add/clone the directory, or plugin_manager with install_bundle and the absolute package path). The bundle row is md-live-edit.

From npm

npm pack @fanfan4589/dsh-md-live-edit
tar -xzf fanfan4589-dsh-md-live-edit-*.tgz
# add the extracted package directory as a bundle in DSH

Development

npm test        # node --test test/*.test.mjs — 34 cases
PathResponsibility
index.jsHost half: the admission-gated POST /dsh-md-live-edit/api/write route
client.jsClient half: preview metadata, keyed document body, block parser and in-place editor
test/gate.test.mjsRoute admission, body/fs isolation on rejection, sandbox policy
test/client.test.mjsModule identity, registration metadata, parser round-trip, text transforms
test/render.test.mjsEnd-to-end body rendering under a VM timeout
test/inline.test.mjsInline renderer termination, watched in a child process
test/labels.test.mjsLocalized labels, no raw locale keys in the UI

See CONTRIBUTING.md and RELEASING.md.

License

MIT © feifandiv

Comments

Loading…

Similar plugins

dsh-md-annotator

by 3361805598-gif

DSH Markdown sidebar viewer and editor with block- and text-range annotations for structured revision requests.

Tools & CapabilitiesDevelopment & InfrastructureTerminal & ClientsManifest valid

★ 4

MIT

JavaScript

Sep 13, 2026

dsh plugin --profile web add dsh-md-annotator

by zhxnix

WYSIWYG Markdown notes editor in the DSH right sidebar, with tabbed documents, table editing, chat integration, assistant read/write tools, and local file export.

UI & ExperienceManifest valid

★ 0

MIT

JavaScript

Nov 1, 2026

dsh plugin --profile web add dsh-madedown

Outline notes with a live mind-map view in a sidebar page, stored as local JSON with autosave, daily backups and Markdown/OPML import and export. Its HTTP routes have no DSH access check, so a web pag

Development & InfrastructureManifest valid

★ 0

MIT

TypeScript

dsh plugin --profile web add @huoweifang/dsh-mindmap

by 2017java

DSH web 插件:在 dsh-better-sidebar 侧边栏内把 Markdown 富渲染为预览(代码高亮 / 目录 / 一键复制)。

Terminal & ClientsManifest valid

★ 0

MIT

JavaScript

Aug 25, 2026

dsh plugin --profile web add dsh-md-viewer

by caihua8669

Document review workbench: select text in a Markdown file, leave comments saved as MRSF sidecar files next to it, and let the agent read them with doc_review_* tools and propose edits you accept or re

Development & InfrastructureTerminal & ClientsManifest valid

★ 1

MIT

JavaScript

Oct 17, 2026

dsh plugin --profile web add @caihua/dsh-doc-review

dsh的diff审核

Security & AuditManifest valid

★ 1

MIT

JavaScript

dsh plugin --profile web add dsh-diff-review