Introduction¶
The DSH (DeepSeek Harness) ecosystem emphasizes “everything is a plugin.” When using dsh-better-sidebar to view and edit Markdown files, exporting content as a static page or PDF for sharing typically requires external tools. dsh-md-export is an extension designed for DSH Web plugins. It integrates export functionality directly into the dsh-better-sidebar toolbar, allowing users to generate standalone HTML or PDF files without leaving the current interface.
What Is This¶
This is a DSH Web plugin maintained by AnakinCao. Its core function is to append an “Export” button to the Markdown file viewer toolbar in dsh-better-sidebar. With this button, users can export the current .md file being edited to a standalone HTML file (including inline Mermaid diagrams) with one click, or generate a PDF through the browser’s print feature.
Core Features¶
- Zero dependencies, preserves built-in behavior: The plugin does not replace the preview, editing, or saving logic built into
dsh-better-sidebar; it only supplements the toolbar. - What you see is what you get: The exported HTML is taken directly from the rendered DOM of the built-in previewer (including SVGs generated by Mermaid), without secondary rendering.
- Save in the same directory: By default, generated HTML files are saved in the same directory as the Markdown file. The file name is the same as the original file, with only the extension changed to
.html. - Theme follows the previewer: The exported HTML layout and styles automatically follow the current previewer theme (light/dark). It is not optimized for printing on A4 paper.
- Editor-friendly: If in editing mode, the export operation automatically switches to preview mode to ensure the exported content is up to date.
- Automatic appearance: The button automatically appears or hides based on changes in file type and preview/edit mode.
Installation and Enabling¶
The installation command is as follows:
dsh plugin --profile web add <dsh-md-export-0.1.0.tgz>
After installation completes, restart the dsh web process to load the new plugin package. Then perform a hard refresh in the browser (Cmd/Ctrl + Shift + R).
Typical Usage¶
- Open any
.mdfile indsh-better-sidebar. - Find the new Export ▾ button on the toolbar.
- Click the button and choose the export method:
- Save HTML (same dir): Save the file as HTML with the same name as the Markdown file, in the same directory as the Markdown file.
- Export PDF (print): Open the browser’s print dialog, where you can choose “Save as PDF”.
Applicable Scenarios and Notes¶
- Dependencies: The plugin depends on internal CSS class names in
dsh-better-sidebar(such as thenArs4W_prefix). Ifdsh-better-sidebaris upgraded and these internal class names are changed, the plugin may need to be updated to maintain compatibility. - PDF limitations: PDF export relies on the browser’s print feature. The plugin cannot directly generate a
.pdfbinary file and save it to the Markdown directory. It must be saved manually through the browser’s print dialog. - HTML save limitations: Saving HTML relies on session detection (reading
dsh-sidebar:v1:*keys inlocalStorage). If detection fails in specific edge cases, it falls back to browser download behavior. - File types: The plugin currently applies only to
.mdfiles, but it also supports the.markdownextension.
Short Conclusion¶
dsh-md-export provides DSH users with a lightweight Markdown export solution. It leverages the existing rendering engine and achieves conversion from Markdown to static pages with a small amount of code. See its GitHub repository or plugin directory page for more details and source code.
Links¶
- GitHub: https://github.com/AnakinCao/dsh-md-export
- Directory page: https://www.skillhub.cn/plugins/AnakinCao/dsh-md-export