READMESource: main@d438aeb7
Markdown Export
A DeepSeek Harness plugin that adds Export to the Markdown document preview. Turn the Markdown file you have open into a self-contained HTML file, or a PDF, without leaving the app.
Features
- Export → HTML document — downloads a single
.htmlfile with inline styles and local images embedded as data URIs. The file works offline and can be sent to anyone. - Export → PDF document — renders the same document in a hidden print frame and opens the system print dialog; choose a PDF printer or "Save as PDF".
- Markdown only — the button appears only for
.md/.markdownfiles in the document preview toolbar. - Reads what the preview reads — the source is read through the Harness
workspaceFilesRemote, so the export always reflects the current file on the Host. - Localized — Chinese and English UI text follow the app locale.
Supported Markdown
| Group | Syntax |
|---|---|
| Headings | ATX (#) and Setext (=== / ---), auto-generated anchor ids |
| Emphasis | **bold**, *italic*, ***both***, ~~strikethrough~~, \inline code`` |
| Blocks | Paragraphs, hard line breaks, horizontal rules, blockquotes (nested) |
| Lists | Ordered / unordered, nested, task lists (- [x]), loose and tight lists |
| Code | Fenced blocks with language label, indented code blocks |
| Tables | GFM tables with :---, :---:, ---: alignment |
| Links & images | [text](url), <https://…>, , titles |
| Footnotes | [^id] references and [^id]: definition |
| Other | YAML front matter (used for the title only, stripped from output) |
Raw HTML is escaped rather than rendered, and javascript: / vbscript: URLs are dropped, so an exported file is safe to share.
How it works
client.jsregisters a list entry in thesidebar.right.tab.document.actionsslot of the built-in document preview.- On click, the Markdown file is read with
ctx.remote.workspaceFiles.readBytes(...). - The built-in renderer parses the Markdown into HTML, applies the export stylesheet, resolves relative image paths against the file's directory, and embeds up to 16 local images (bounded at 10 MiB total).
- HTML: a Blob URL is created and downloaded as
<file-name>.html. - PDF: the same HTML is loaded into a hidden
iframeandprint()is called; the print stylesheet handles page margins andbreak-inside: avoidfor code blocks, tables, and images.
The Host half (index.js) is empty — everything happens in the browser.
Installation
Install the bundle as a local package in the current profile:
- Open the DeepSeek Harness Web UI.
- Install this directory as a bundle, e.g. with the plugin manager's
install_bundleaction and the absolute path to this folder. - The change applies immediately; refresh the page if it was already open.
The package declares dsh.bundle.patch (cordis.patch.yml, which inserts the markdown-export row) and a dsh.client section with the required client packages. No dependencies or build step are needed.
Usage
- Open a
.mdfile from the workspace file tree so it shows in the right-hand preview. - Click Export in the preview's toolbar (next to the reload button).
- Choose a format:
- HTML document — the file is downloaded straight away.
- PDF document — pick a PDF printer or "Save as PDF" in the dialog that opens.
Project structure
markdown-export/
├── package.json # bundle manifest (dsh.bundle + dsh.client)
├── cordis.patch.yml # inserts the plugin row
├── index.js # Host half (no-op)
├── client.js # Markdown renderer + toolbar action
├── icon.svg # plugin icon
└── locale/
├── en.json # English display metadata
└── zh.json # Chinese display metadata
Limitations
- PDF output uses the browser's print pipeline, so the file is produced by the print dialog rather than downloaded directly.
- Only the part of the document the preview has loaded is available: the export reads the file through the documented workspace API, so very large files are subject to its read limits.
- Local images are embedded from disk; remote
http(s)images stay as links and need network access when the HTML is opened. - Syntax highlighting is limited to the language label above a fenced code block.
No comments yet. Be the first to write one.