From md2word
Converts Markdown to .mht, .docx, and .wordmath.docx using Windows + Microsoft Word. Supports templates (MHT/DOCX/spec), LaTeX-to-Office Math conversion, Mermaid diagrams, and academic paper styling.
How this skill is triggered — by the user, by Claude, or both
Slash command
/md2word:md2wordThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
目标:
目标:
Markdown -> MHT -> DOCX -> WordMath DOCX
这个 skill 默认面向 Windows 直接运行。内置模板只是 fallback,不要把它理解成“只能导出专利交底书”。
.mht 模板.docx 模板,希望复用现有 Word 样式$...$、$$...$$、Mermaid 代码块,且最终必须落到 Wordpy -3、python 或 python3 调起pygments;未安装时自动回退为可编辑纯文本代码块mmdcnpx -p @mermaid-js/mermaid-cli mmdcnpx 兜底可能需要联网下载$...$$$...$$**标题:** 示例文档标题: 示例文档# 标题,正文也会被正确识别,不要求一定写 ---标题 / 题目 / 主题 取值;没有时再回退到 发明名称 / 项目名称.mht:直接使用.docx:先归一化导出为 .mht.mhtrender_mht.py 把 Markdown 填进模板。.docx。.wordmath.docx。template-spec.md 再传给 --template-specresources/template-spec.mddefaultacademic-paperresources/style-preset: academic-paper--style-preset academic-paper{{CONTENT}} 或 <!--MD_CONTENT-->,优先按占位符替换{{METADATA_TABLE}},会把 Markdown 头字段渲染成信息表项目名称、电话、版本,会按行标签尝试填值WordSection,优先替换最后一个正文 section--template-report 输出报告使用内置默认模板:
<skill-dir>\scripts\md2word.cmd `
--input disclosure.md
使用模板规格生成模板:
<skill-dir>\scripts\md2word.cmd `
--input example.md `
--template-spec template-spec.md `
--template-out generated-template.mht `
--template-report template-report.md
生成学术论文格式:
<skill-dir>\scripts\md2word.cmd `
--input example.md `
--template-spec template-spec.md `
--template-out academic-paper.mht `
--template-report academic-paper.report.md `
--style-preset academic-paper
使用现成 Word 宏而不是内置公式转换:
<skill-dir>\scripts\md2word.cmd `
--input disclosure.md `
--macro-name "LatexToWordMath_Better"
直接调用 Python 主脚本:
py -3 <skill-dir>\scripts\md2word.py `
--input disclosure.md `
--style-preset academic-paper
关闭代码语法高亮、只导出可编辑纯文本代码块:
<skill-dir>\scripts\md2word.cmd `
--input disclosure.md `
--code-render-mode editable-code
兼容旧的 PowerShell 包装入口:
powershell -ExecutionPolicy Bypass -File <skill-dir>\scripts\md2word.ps1 `
-Input disclosure.md `
-StylePreset academic-paper
render_mht.py 会把 Markdown 图片作为 MHT 关联资源打包进去highlighted-code 模式),带背景、边框和 [语言] 标签;未装 pygments 时自动回退为可编辑纯文本;可用 --code-render-mode editable-code 强制纯文本render_mht.py 会把 Mermaid 代码块渲染成图片插入 MHTrender_mht.py 会归一化模板页脚里的 PAGE/NUMPAGES 布局,避免页码和总页数被拆成两段headless shell 在受限环境下失败md2word.py 会在生成的 DOCX 中把 Markdown 标题映射回 Word Heading 样式和大纲级别word_mht_pipeline.ps1 会把常见块公式环境归一化后再交给 Word BuildUpmatrixpmatrixbmatrixBmatrixvmatrixVmatrixcases\begin{matrix}...\end{matrix} 原样直接 BuildUp;要先转成 \matrix{...} 或外层加分隔符scripts/md2word.py:Python 主入口,统一编排模板分流、渲染和 Word 流水线scripts/md2word.cmd:Windows 命令行包装器,转发到 Python 主入口scripts/md2word.ps1:PowerShell 兼容包装器,转发到 Python 主入口scripts/pipeline_common.py:主入口共享的参数校验、路径规划和文件校验逻辑scripts/render_mht.py:渲染 MHT、处理正文和 Mermaidscripts/generate_template_mht.py:从模板规格生成可复用 MHT 模板scripts/style_presets.py:统一加载样式预设配置scripts/word_common.ps1:Word worker 共享的 COM 清理与路径 helperscripts/word_template_to_mht.ps1:DOCX 模板归一化为 MHTscripts/word_mht_pipeline.ps1:Word 导出与 Office Math 转换resources/template-spec.md:模板规格参考resources/style-presets.json:样式预设配置resources/专利交底书模板.mht:默认 fallback 模板mmdc;没有的话确认是否允许 npx 下载--template-report.docx 已经错:问题在 MHT 或公式文本归一化.docx 正常、.wordmath.docx 才错:问题在 Word BuildUp\matrix{...} 族,而不是残留 \begin{...} / \end{...}npx claudepluginhub cp-yu/md2word --plugin md2wordConverts Markdown documents to professionally formatted Word documents with Chinese typography standards. Supports multiple presets (academic, legal, report) and custom configuration.
Converts Markdown to professionally styled DOCX files with python-docx. Handles CJK/Latin mixed text, tables, code blocks, blockquotes, cover pages, TOC, watermarks, and page numbers. Supports multiple color themes.
Converts Markdown to professionally styled PDFs with Mermaid diagrams, LaTeX/KaTeX math, tables, and syntax-highlighted code blocks.