Introduction

In the DeepSeek Harness (DSH) plugin ecosystem, typography issues are often overlooked when working with Chinese web copy. Explicit line-break errors (such as single-character lines) or missing CSS protection rules can cause poor page rendering in the browser. cn-linebreak is an audit and repair tool designed for these types of issues.

What Is This

cn-linebreak is an audit and repair tool for line breaking in Chinese web copy. Maintained by chiang21fcb, it is a zero-dependency, pure JavaScript (requires Node >= 18) static HTML auditor. The tool converts the rules from the “Chinese Web Copy Line-Breaking Repair Guide” into executable checks, aiming to resolve explicit line-break errors and high-risk patterns.

Core Features

This plugin provides the following core capabilities:

  • Audit explicit line-break errors: Checks for single-character lines, punctuation rule violations (such as prohibited punctuation at line starts or line ends), missing word-break: keep-all, blanket white-space: nowrap overrides on text elements, and protected phrases split across line breaks.
  • Automatic repair: Automatically inserts <wbr> tags at natural pause points (such as ,。;:、). In repair mode, scripts, styles, preformatted text regions, and .no-break protected areas are skipped.
  • Agent tool: After installation, the DSH agent can directly invoke the cn_linebreak_audit tool.
  • Static auditing: Supports comprehensive inspection of static HTML.

Installation and Enablement

Install the plugin package (which is also a standard plugin package for DeepSeek Harness):

dsh plugin --profile <name> add cn-linebreak

After installation, the plugin registers the cn_linebreak_audit tool for agent invocation. The tool supports overriding parameters such as protectedPhrases (the protected phrase dictionary) via configuration.

Typical Usage

The following are typical usage examples in the command line and in code:

# 审查一个文件
npx cn-linebreak page.html

# 审查并输出修复版 HTML(stdout),摘要走 stderr
npx cn-linebreak --fix page.html > page.fixed.html

# 完整 JSON 报告
npx cn-linebreak --json page.html

In a JavaScript environment, it can be imported via CommonJS:

const { auditHtml } = require('cn-linebreak')
const report = auditHtml('<p>读产品手册,提取事实,输出文档。</p>', { mode: 'fix' })
console.log(report.issues)

Use Cases and Precautions

This tool is suitable for developers who need standardized line-breaking checks for Chinese web pages.

Keep the following points in mind:
* Limitations of static inspection: The tool can only see explicitly present <br>/<wbr> elements and text/CSS structures in the HTML. It cannot detect actual line-break results after browser rendering with real font sizes and container widths.
* Conservative repair mode: Repair mode inserts tags mechanically; any semantic boundaries (such as product names) require manual review.
* Manual review: It cannot identify single-character lines produced after browser rendering (this feature is planned for v0.4.0 in the roadmap).

Conclusion

cn-linebreak provides a standardized approach to checking line breaking in Chinese web copy and is suitable for integration into DSH workflows. By using explicit line-break marks (<wbr>) and CSS rules, it can help improve the typographic quality of Chinese web pages.

View catalog page
View GitHub repository