dsh-tool-notion: Bidirectional Conversion between Notion Blocks and Markdown

Preface

When working with notes, documentation, or Runbook-style content in DeepSeek Harness (DSH), a common workflow is: exporting from Notion or obtaining block arrays via the API, editing locally in Markdown, running tests, or processing with agents; once finished, the content needs to be converted back into a block shape that Notion can append. Hand-writing the “array ↔ string” conversion often underestimates the asymmetry caused by rich text runs, annotation boundaries, and callout mapping. Below is an introduction to the community plugin dsh-tool-notion (maintainer: yuehancn), which provides offline conversion tools within the DSH process without making any Notion network requests.

What is this

dsh-tool-notion is a tool plugin for DeepSeek Harness: it converts Notion block arrays into Notion-flavored Markdown, converts Markdown back into writable block arrays, and includes structural validation and capability queries. The README explicitly states that there is no Notion API client; the conversion process does not make external network requests, making it suitable for offline execution and automated testing.

In the SkillHub plugin directory, this entry is categorized as “Model Inference,” consistent with the directory description “DeepSeek Harness plugin”; specific capabilities are subject to the repository’s README. The current GitHub star count is 0; the package.json version is 1.0.0, licensed under MIT. The DSH community directory is an independent site and has no official affiliation with DeepSeek / High-Flyer.

Core Features

The plugin exposes its capabilities through four tools (names from the README):

Tool Function
notion_status Pre-conversion query: supported block types for Markdown/Block conversion, five annotation keys, callout label to emoji mapping, absolute paths for workDir / outputDir
notion_to_md Block array → Notion-flavored Markdown; structures that cannot be represented are explicitly reported
notion_to_blocks Markdown → Block array, producing a data shape directly compatible with Notion append-style interfaces
notion_validate Does not convert; checks for “round-trip information loss” issues such as block structure, unknown block types, empty runs, and callout read-back risks

Parameter Entry Points (excerpted from README):

notion_to_md accepts one of three formats:

{ blocks:        [ … ] }
{ blocksJson:    "[…]" }        // String-format API response, internal JSON.parse
{ results: { … } }              // API wrapper object containing results

README Note: Since defineTool validates types before execute, blocks only accepts arrays; raw API objects must go through blocksJson or the wrapper containing results to avoid the framework rejecting them early with "blocks" must be an array.

notion_to_blocks:

{ markdown: "# Title\n\nSome **bold** text." }
{ path: "notes/export.md" }        // Resolved relative to workDir

notion_validate accepts blocks / blocksJson, focusing on structural issues that cause silent information loss, rather than a complete determination of “legality” on the Notion side.

In terms of implementation, Notion paragraphs consist of multiple rich text runs (each with bold / italic / strikethrough / underline / code and links), while Markdown paragraphs are single strings; splitting and merging runs are not simple inverse operations. This is the primary focus of the plugin’s logic and tests. Details such as inline marker order, backslash parity, fence widening, and the bijective mapping of callout semantic tags to emojis are explained in the README, accompanied by 403 test assertions (three suites).

Installation and Enablement

  1. Declare the working directory and output directory in the DSH plugin configuration (from the cordis.patch.yml example in the README):
# cordis.patch.yml
plugins:
  dsh-tool-notion:
    workDir: "."
    outputDir: "notion-output"
  1. Install the plugin (command must match the documentation):
dsh plugin add dsh-tool-notion

package.json requires the dsh engine >=0.2.0-rc.2 and declares peer dependencies such as @deepseek-ai/cordis and @deepseek-ai/dsh-tools; after installation, load cordis.patch.yml according to your Harness project’s method.

Typical Usage

Check Capability Boundaries First

Before batch conversion, call notion_status and compare against toMarkdown, toBlocks, annotations, callouts, and directories. List “unsupported block types” as known boundaries to avoid discovering content loss mid-conversion.

Export → Markdown

Pass the block array obtained from Notion export or API (or the blocksJson / results wrapper) to notion_to_md to obtain Markdown maintainable in repositories or editors. When structural confirmation is needed, run notion_validate before conversion.

Markdown → Writeback to Blocks

After modifying Markdown locally, use notion_to_blocks to pass a string, or read a file relative to workDir via path (README Note: path is resolved relative to workDir; absolute paths are concatenated after workDir, used to restrict reading outside the configuration root). Pass the resulting array to your proprietary Notion API calling layer for appending.

Local Validation

Test entry point provided by the maintainer:

node _test/run-all.mjs

The README records 403 passed tests across three suites (logic / integration / e2e), used for regression testing of inline scanning, tool schemas, workDir path rules, and end-to-end document round-trips.

Applicable Scenarios and Notes

Who it is for

  • Teams or individuals already orchestrating tools in the DSH or Cordis ecosystem who need to perform round-trip conversion between Notion blocks and Markdown without an API client and without network access.
  • Scenarios where conversion failures or information loss must be reported, rather than silently swallowing runs, callouts, or unknown block types.
  • Workflows requiring notes to be exported to Git, CI tests, or agent-readable text, and then generating Notion block payloads (network and authentication are still handled by your own Notion integration).

Notes

  • The plugin runs under the current DSH process permissions; the path in notion_to_blocks is constrained by workDir. Before installation, you should review the source repository and the MIT license to ensure compliance with internal network and security requirements.
  • Unsupported or unmapped block types will not magically transform into full-featured Notion equivalents; always evaluate the loss surface using notion_status and notion_validate.
  • The SkillHub category “Model Inference” describes the directory classification and is not equivalent to built-in large model inference in the plugin; it is essentially a format conversion tool.

Conclusion

dsh-tool-notion consolidates bidirectional conversion, validation, and capability queries between Notion block arrays and Notion-flavored Markdown into four DSH tools. It emphasizes annotation boundaries, callout bijections, and explicit error reporting, facilitating offline testing and documentation pipelines. For further information, please visit the SkillHub directory page and the GitHub repository.

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye