dsh-document-reader
A document & image reader panel — and a Markdown notes editor — for DeepSeek Harness (DSH). Open local files in a real reader surface instead of chat attachments, edit notes in place, and let the assistant read and write along.
DSH 文档阅读器:在独立面板里读 PDF、Office、EPUB 和 Markdown,像在笔记软件里一样编辑,并让对话里的 AI 直接读你的文档、按你的许可写笔记。
Screenshots
| Reading: notes tree, outline and rendered Markdown | WYSIWYG editing: select text, get a formatting toolbar |
|---|---|
![]() |
![]() |
| Translate a passage: Bing, Google or your own DSH model | ⚙ Settings, also available as a standard DSH settings page |
|---|---|
![]() |
![]() |
Features
Read
- PDF (continuous scroll, text-layer search, zoom/rotate/fit), DOCX, EPUB, HTML, Markdown, plain text (UTF-8 / GBK / Big5 / Shift-JIS), images, and Office decks & spreadsheets (
.pptx .xlsx .ppt .xls .doc, converted through the LibreOffice engine bundled with DSH). - Outline navigation, in-document search with highlighted matches, scroll position restored per file, recent files, rename in place, readable line width.
- Open documents in a tab beside the conversation (the right sidebar), or in the main panel. Links to documents in chat open there too.
- Select text anywhere: quote it into the chat, copy, search in the document or translate it — Bing, Google, or the DSH model you have configured.
Edit Markdown, losslessly
- A WYSIWYG editor: idle blocks are rendered, the block under the caret is a real textarea (IME-safe). The draft is always the same Markdown string — edits are byte-level splices, so the rest of the file never changes.
- Editing commands: headings, bold / italic / strikethrough / code / highlight / links, blockquotes, tables, ordered and unordered lists, tasks, callouts, footnotes, front matter, formulas (
$…$and$$…$$, rendered by KaTeX). A selection toolbar and a "+" insert menu put them one click away; the five shortcuts that collide with DSH on macOS can be rebound. - Paste rich text from web pages, Word or AI chats and it arrives as Markdown. Cross-block undo, autosave, unsaved-draft recovery, and a conflict bar when the file changed on disk (keep mine / merge / reload).
Notes library
- A file tree for a notes folder: create, rename, move and delete notes and folders, a note for today, and templates you can apply to any note.
- Wiki links (
[[note]], aliases, headings), backlinks, embedded notes, hover preview of linked notes.
Work with AI
doc_readeragent tool: the assistant reads, outlines and searches local documents in any supported format.noteagent tool: the assistant creates, appends to or replaces notes in your notes library — on by default, confirmed once per session, with a backup of every edited note kept for 30 days.- The outline of the active document is injected into the chat context, so the assistant knows what you are reading.
/docand/noteslash commands open recent documents from the composer. Tool results render as cards with "open in reader"; an assistant answer can be saved as a note.- Inline AI edit: select a passage, ask for a rewrite, then review a diff and keep yours, merge or take the AI version.
- Related sessions: notes mention which conversations talked about them.
Settings
- A ⚙ card in the panel and a standard page in DSH settings, with a search over every setting and group anchors.
- Base font size, line height, PDF text layer, DOCX pagination, line numbers, list markers, side spacing, UI language (Simplified / Traditional Chinese / English), translation engine and target.
Security posture: extension whitelist, symlink rejection, atomic writes, loopback + cross-site guards on all Host routes, sanitized HTML/EPUB rendering, size caps and timeouts everywhere. AI note writing is limited to the notes library.
中文说明
- 读:PDF、Word、EPUB、HTML、Markdown、纯文本(多编码自动识别)、图片,以及 Office 演示稿和表格(经 DSH 自带的 LibreOffice 引擎转换)。大纲导航、文内搜索、阅读位置记忆、最近文件;可以在右侧栏的标签页里边聊边读。选中一段文字可以引用到对话、复制、文内搜索或翻译——必应、Google、已配置的 DSH 模型三选一。
- 编辑 Markdown,严格无损:所见即所得,非活跃块是渲染效果,光标所在块是真文本框(中文输入法安全)。编辑只按块做字节级替换,文档其余部分一个字节都不变。标题、粗体、表格、列表、任务、标注块、脚注、公式都有命令;选中文字有工具条,「+」有插入菜单;从网页、Word 或 AI 对话里粘贴的富文本会自动转成 Markdown。跨块撤销、自动保存、草稿恢复,文件被外部修改时给出冲突条(保留我的 / 合并 / 重载)。
- 笔记库:文件树里新建、重命名、移动、删除笔记和文件夹,今日笔记,可套用的模板;双链、反向链接、嵌入与悬停预览。
- 与 AI 协作:
doc_reader工具让助手读取、梳理大纲、搜索本地文档;note工具让助手在笔记库里新建、追加、替换笔记(默认开启,每个会话首次写入前确认,改过的笔记备份 30 天);当前文档的大纲自动进入对话上下文;/doc与/note命令;选段 AI 改写带差异对比(保留我的 / 合并 / 采用 AI 版);回答可以存为笔记;相关会话。 - 设置:面板里的 ⚙ 卡片和 DSH 标准设置页,设置项可搜索、分组可跳转。
What's new in 2.0.0 / 2.0.0 主要更新
2.0.0 is the first public release since 1.0.3 and turns the reader into a notes editor wired into DSH's agent tools. 2.0.0 是 v1.0.3 之后的首次公开发布:阅读器升级为与 DSH 的 Agent 工具打通的笔记编辑器。
- WYSIWYG Markdown editing — strictly lossless, with editing commands, a selection toolbar, an insert menu, rich-text paste, line numbers, rebindable shortcuts and conflict handling. / 所见即所得编辑:严格无损,带编辑命令、选区工具条、插入菜单、富文本粘贴、行号、可改绑的快捷键和冲突处理。
- A notes library and a right-sidebar reading tab — file tree, templates, today's note, wiki links, backlinks and embeds. / 笔记库与右栏阅读:文件树、模板、今日笔记、双链、反向链接与嵌入。
- AI reads and writes — the
notetool (confirmed, backed up), inline AI edit with a diff, save-as-note cards, related sessions, and/notenext to/doc. / AI 读写:note写入工具(先确认、有备份)、选段 AI 改写与差异对比、回答存为笔记、相关会话,以及/note命令。 - Obsidian-style Markdown — tasks, callouts, footnotes, front matter, formulas and tables render and edit correctly. / 更多 Markdown 语法:任务、标注块、脚注、属性块、公式和表格都能正确渲染与编辑。
- A real settings page — search over every setting, group anchors, more options, in three UI languages. / 完整的设置页:设置搜索、分组锚点、更多选项,三种界面语言。
- Hardened by four rounds of adversarial review — performance, stability and data safety, text editing and Host routes — plus regression walks in a real Chromium. / 四轮对抗审查:性能、稳定性与数据安全、文本编辑、Host 路由,并在真实 Chromium 里做了回归巡检。
Install
Requires DSH with the plugin system (dsh ≥ 0.2.0).
A. From a plugin market (Discover) — add an index source that lists this package (any index that mirrors dsh-plugin-catalog, or this repository's own index.json), then search "document reader" and install dsh-document-reader.
B. Direct install from npm:
dsh plugin --profile desktop add dsh-document-reader
C. Direct install from GitHub:
dsh plugin --profile desktop add "git+https://github.com/wangjianghu/dsh-document-reader.git"
Open the reader from the left sidebar (book icon) and paste an absolute local file path, or use the file browser. Set a notes folder in ⚙ Settings to get the notes tree. 安装后从左侧栏的书本图标打开阅读器,粘贴本地文件绝对路径回车;在 ⚙ 设置里指定笔记文件夹后,左侧出现笔记目录。
Repository layout
├── index.js # Host half: routes, extraction engine, tool / context / command services
├── client.js # Client half: panel, views, WYSIWYG editor, selection bar, settings
├── client.vendor.js # Lazy chunk: markdown-it + jszip + docx-preview
├── client.pdfjs.js # Lazy chunk: pdfjs-dist + worker
├── client.katex.js # Lazy chunk: KaTeX with its stylesheet
├── cordis.patch.yml # Loader rows (reader + translator service)
├── locale/ # Plugin-manager display metadata (en / zh)
├── tools/ # Regression suites (host / client / smoke) + vendor build
└── index.json # DSH plugin-market index (format 1), self-hosted
Development
The plugin is dual-half (Host services + Client slots). Iterate by linking the package directory:
dsh plugin --profile desktop add "link:$(pwd)"
Host-half changes need a plugin reload; client-half changes a page refresh.
Tests · 测试
Three regression suites live in tools/ (run in CI):
node tools/host-test.mjs # Host half
mkdir -p /tmp/vendor && cd /tmp/vendor && npm init -y && npm i jsdom@24 react@18 react-dom@18 jszip markdown-it@14.1.1
node "$OLDPWD/tools/client-test.mjs" # client half, needs the vendor env above
node "$OLDPWD/tools/smoke-test.mjs" # end-to-end panel smoke
tools/build-vendor.mjs rebuilds the lazy client chunks (client.vendor.js / client.pdfjs.js / client.katex.js). It reads the libraries from the development tree next to the original VSIX extract, so it only runs there; the published chunks are committed and the plugin needs no build step.
License & attribution
MIT — see LICENSE. Bundled third-party libraries are listed in THIRD-PARTY-NOTICES.md.
This project reimplements the feature set of the VSCode extension vscode-doc-reader (publisher DocReader) for DSH. It carries no code from that extension apart from one short heading-slug helper that was written after its counterpart; the open-source libraries it bundles were rebuilt as lazy-loading chunks under their own licenses (see the notices).
本项目参照 VSCode 扩展 vscode-doc-reader 的功能集为 DSH 重新实现:不含该扩展的代码(只有一个短的标题锚点辅助函数是参照它写的),捆绑的开源库按各自许可证重建成懒加载块。




No comments yet. Be the first to write one.