longaotiandedage/dsh-tool-gongwen ↗★ 0
dsh-tool-gongwen
DSH 插件:按 GB/T 9704—2012《党政机关公文格式》生成与校验中文公文(DOCX / PDF),纯 JS 实现,零外部依赖
Install
$
npx -p @deepseek-ai/dsh dsh plugin --profile web add github:longaotiandedage/dsh-tool-gongwenREADME
Read the full README ↗四、使用方法
(一)生成 DOCX
gongwen_docx({
org: "华中科技大学教务处文件",
docno: "教字〔2026〕15 号",
title: "关于开展数值方法课程资源建设的通知",
to: "各教学单位:",
blocks: [
{ type: "body", text: "为加强……现将有关事项通知如下。" },
{ type: "h1", text: "一、建设目标" },
{ type: "h2", text: "(一)总体要求" },
{ type: "h3", text: "1. 讲义建设" }
],
attachments: ["1. 任务分工表", "2. 体例说明"],
signOrg: "华中科技大学教务处",
signDate: "2026年10月26日",
output: "notice.docx"
})
(二)生成 PDF
参数与上节相同,仅将 output 改为 .pdf。
(三)版面校验
gongwen_check({ path: "notice.docx" })
输出为逐项对照表:
项目 实测 国标 判定
页面宽 210 210 OK
上白边(天头) 37 37 OK
版心宽 156 156 OK
正文字号 16 16 OK pt
行距 28 28 OK pt
奇偶页不同页码 1 1 OK
结论:符合 GB/T 9704—2012