In DeepSeek Harness (DSH) sessions, agents typically produce content in Markdown or plain text formats. Directly saving to .docx requires manual conversion or reliance on third-party tools. dsh-docx-export solves this problem by exporting text from DSH sessions into genuine Word documents, rather than simply renaming Markdown files.
This is a client-side plugin maintained by Cai-Chengyu and licensed under the MIT License. Its core value lies in its zero runtime dependencies (relying solely on Node.js’s built-in zlib) and its independence from @deepseek-ai/* packages. This makes it resilient to Harness version drift; it mounts as a plugin package upon installation with no extra configuration required.
Core Capabilities¶
The plugin converts Markdown syntax into Word’s natively supported OOXML structure, supporting the following features:
- Headings & Table of Contents: Heading 1–6 styles (template-friendly and TOC-ready).
- Character Formatting: Bold, italic, strikethrough, and code, with support for CJK (Chinese, Japanese, Korean) fonts.
- Lists: True multi-level bulleted and numbered lists.
- Checkboxes: Converts
- [x]to ☑ and- [ ]to ☐. - Code Blocks: Code areas with monospaced fonts, background shading, and borders.
- Blockquotes: Quote styles with a left border.
- Tables: Generates native Word tables with column alignment support.
- Media: Embeds images (PNG/JPEG/GIF/BMP) and clickable external hyperlinks.
- Document Properties: Auto-populates title, author, and timestamp.
- Footer: Includes page numbers by default.
Installation & Activation¶
You need to restart DeepSeek Harness after installing the plugin so that the new plugin package mount takes effect.
- Via npm (Recommended):
dsh plugin --profile desktop add dsh-docx-export
- Install from GitHub:
dsh plugin --profile desktop add github:Cai-Chengyu/dsh-docx-export
- Install from local directory or archive:
dsh plugin --profile desktop add G:\path\to\dsh-docx-export
dsh plugin --profile desktop add .\dsh-docx-export-1.0.0.tgz
If dsh is not in your system PATH, please use the CLI path provided by the Harness. Once installed, the plugin will take effect upon the next launch.
Typical Usage¶
After installation, there are three primary ways to invoke it.
1. Session Dialogue¶
Simply ask the agent in a DSH session. The model will invoke the export_docx tool:
Export what you just wrote as a Word document titled “Q1 analysis”, with a table of contents.
2. JSON Tool Invocation¶
Directly call the export_docx tool, passing Markdown content and configuration parameters.
{
"content": "# Title\n\nBody **bold**\n\n| col | value |\n|:--|--:|\n| a | 1 |\n",
"title": "Q1 analysis",
"outputPath": "G:\\dsh\\analysis.docx",
"toc": true,
"pageSize": "a4"
}
3. Command Line¶
The plugin includes a built-in CLI that can be used outside of DSH to process local Markdown files.
node bin/docx-export.mjs report.md -o report.docx --title "Quarterly report" --toc
Configuration & Notes¶
Configuration¶
You can override the default configuration in the Harness’s cordis.patch.yml:
- id: docx-export
name: dsh-docx-export
config:
toolName: export_docx # 重命名工具名以避免冲突
outputDir: "D:/exports" # 默认输出目录(空字符串则为会话工作目录)
fontFamily: Calibri # 西文字体
eastAsiaFont: 微软雅黑 # 中日韩字体
monoFont: Consolas # 代码字体
fontSize: 11 # 字号
pageSize: a4
toc: false # 默认插入目录
footer: true # 默认包含页码
allowOutsideWorkspace: false # 是否允许写入工作目录外
allowedRoots: [] # 允许的额外目录
maxContentChars: 400000 # 单次导出内容限制
Notes¶
- Environment Requirements: Requires Node.js >= 20, compatible with DSH 0.1.7+.
- Permission Security: By default, the plugin only writes to the session’s working directory. To write to external paths, you must explicitly set
allowOutsideWorkspacein the configuration or specify paths viaallowedRoots. Image embedding is also restricted to allowed scopes. - Version Drift: Because it does not import any
@deepseek-ai/*packages, the plugin can run stably across different versions of the Harness over the long term.
Ecosystem & Links¶
Following DSH’s pluginization philosophy, this plugin has been published to the community directory, with its source code hosted on GitHub.
- GitHub Repository: https://github.com/Cai-Chengyu/dsh-docx-export
- Community Directory: https://www.skillhub.cn/plugins/Cai-Chengyu/dsh-docx-export