跪拜 Guibai
← All articles
DeepSeek · Agent · Markdown

DSH gets a real markdown editor: QuireKit's multi-mode, lezer-optimized plugin goes open source

By king王一帅 ·
Read original on juejin.cn ↗ Google Translate ↗ Alt translation

DSH users can now edit long markdown documents without leaving the agent, and the underlying lezer changes point to a concrete way to keep incremental parsing fast on very large files. For anyone embedding markdown editors, the batched-comment-to-agent flow is a working example of turning editor annotations into agent work items.

Summary

QuireKit's dsh-quirekit-md-editor turns DSH's read-only markdown preview into a full editing experience. The editor is built on codemirror with a tiptap-style API, and supports pure source mode, a hybrid mode that shows selected blocks as raw markdown, and a full rich-text mode that hides all fences while keeping the underlying document as markdown. Menus, comments, and formatting operate across all modes.

The most consequential work is in the parser. QuireKit vendors codemirror and modified lezer's incremental parsing: unchanged groups of nodes are reattached wholesale instead of block-by-block, so typing in a 3-million-character document costs about the same as in a 100-thousand-character one. Measurements show syntax-tree visits dropping from 107,760 to 1,380 and comparisons from 153,940 to 660. Complex structures like large lists fall back to the original logic for correctness.

Beyond editing, the plugin ships a formula editor, diagram support (mermaid, plantUML, Graphviz, flowchart, mind map, Excalidraw), and a comment system that can send selections or entire comment batches to DSH for agent-driven fixes. It requires DSH 0.2.2-rc.1 or above and installs via `dsh plugin --profile web add dsh-quirekit-md-editor`. The editor itself is available as `@quirekit/md-editor` for embedding.

Takeaways
— DSH 0.2.2-rc.1 or higher is required; the plugin installs via `dsh plugin --profile web add dsh-quirekit-md-editor`.
— The editor supports three modes: pure source, hybrid source-preview, and full rich text, all sharing the same menus and comment system.
— The lezer parser optimization reattaches unchanged node groups in one pass instead of block-by-block, making per-keystroke parsing cost nearly independent of document length.
— Measured improvements: syntax-tree visits dropped from 107,760 to 1,380 (98.7% less) and comparisons from 153,940 to 660 (99.6% less).
— Very large lists fall back to the original lezer parsing logic to preserve correctness.
— The editor includes a formula editor, mermaid/plantUML/Graphviz, self-developed flowchart and mind map components, and Excalidraw, all stored as text.
— Comments can be sent individually or batched to DSH; after the agent applies fixes, comments automatically mark as resolved.
— The editor is open source under MIT and can be embedded via `npm install @quirekit/md-editor`.
Conclusions

The performance numbers show that incremental parsing can be made dramatically cheaper by reusing tree groups, not just blocks; this is a pattern other markdown editors could adopt.

Batch comment-to-agent turns the editor into a review surface: instead of pasting snippets one by one, a user can annotate multiple issues and send them as a single work order.

Building rich-text on codemirror rather than tiptap avoids the markdown-formatting round-trip problem, letting all modes share one underlying md string.

The author is explicit about integrating into agent products rather than competing with them, which is a pragmatic positioning for editor tooling in the AI era.

Concepts & terms
MSFE (Markdown Source-First Editor)
An editor framework where the canonical document is always markdown source, with rich-text rendering layered on top. This avoids the lossy conversions that happen when using a separate rich-text engine like tiptap and then serializing back to markdown.
Lezer incremental parsing with group reuse
Lezer's parser normally reuses unchanged nodes block by block when re-parsing after an edit. QuireKit's modification packs unchanged groups of nodes and reattaches the whole group at once, cutting the per-keystroke work so that very long documents parse as cheaply as short ones.
DSH (DeepSeek's agent/CLI)
A command-line AI agent from DeepSeek, used here as an alternative to codex or claude code for simpler tasks. The plugin integrates a markdown editor into DSH's interface.
Source: juejin.cn ↗ Google Translate ↗ Backup ↗