This converts Markdown to professionally formatted Word documents with Chinese typography standards built in. It comes with presets for legal documents, academic papers, and reports, plus full configuration through YAML files. The tool handles encoding detection, auto-compresses oversized images, and degrades gracefully when Mermaid diagrams fail. It separates concerns nicely: Word templates control visual branding while config files handle formatting parameters like spacing and margins. The legal preset being default and the WeChat contact in the author field tell you exactly who built this and why.

skills.sh installs
287
GitHub stars
788
last updated
Aug 21, 2026

Install

$ npx -y skills add cat-xierluo/legal-skills --skill md2word --agent claude-code

Installs into .claude/skills of the current project.

Files

Markdown转Word文档Skill

概述

将 Markdown 文档转换为符合中文排版标准的 Word 文档。支持完整的 Markdown 语法,自动应用专业格式设置。

依赖要求

Python 依赖

pip install python-docx Pillow beautifulsoup4 PyYAML

可选依赖

npm install -g @mermaid-js/mermaid-cli   # Mermaid 图表渲染
brew install librsvg                       # SVG→PNG(推荐,rsvg-convert)
# 或 pip install cairosvg                  # SVG→PNG 备选
# 或 npm install puppeteer                 # SVG→PNG 备选(scripts/svg2png.js)

正文内联 <svg>...</svg> 块会自动渲染为 PNG 嵌入,渲染优先级 rsvg-convert → cairosvg → svg2png.js(puppeteer),三者任一即可;全部不可用时降级为代码框显示 SVG 源码。

快速开始

主转换脚本:scripts/md2word.py

# 基本转换
python scripts/md2word.py input.md output.docx

# 使用预设格式
python scripts/md2word.py input.md --preset=academic

# 使用自定义配置
python scripts/md2word.py input.md --config=my-config.yaml

# 脚注/尾注模式(默认 footnote 页面脚注;endnote=文档末注释+上标编号)
python scripts/md2word.py input.md --notes=endnote

# 全书合并:多章 md → 单 docx(目录+按输入文件分章+页眉,配合 -o 指定输出)
python scripts/md2word.py --book ch01.md ch02.md ch03.md -o book.docx --preset=book-publish

Sponsors

Details

Repository
github.com/cat-xierluo/legal-skills
Category
Office & Documents
First seen
Jun 3, 2026

More from cat-xierluo/legal-skills

All 5
1zrong avatarfeishu-imagezrong/skillsSend images and screenshots via Feishu (Lark) messaging platform. Use when the user asks to send screenshots, images, or any visual content through Feishu. This278skills.sh installs
2davila7 avatarrwkv-architecturedavila7/claude-code-templatesRNN+Transformer hybrid with O(n) inference. Linear time, infinite context, no KV cache. Train like GPT (parallel), infer like RNN (sequential). Linux Foundation277skills.sh installs
3riba2534 avatarfeishu-cli-cardriba2534/feishu-cli构造美观、元素丰富的飞书 V2.0 交互式卡片(interactive card)。支持折叠面板、 多栏布局、图表、彩色标签、按钮组、人员卡、流式更新等 20+ 组件,内置 7 个场景模板 (通知 / 成功报告 / 告警 / 审批 / 数据大屏 / 文章摘要 / AI 流式)和配色布局规范。 当用户请求"发卡片"、"发277skills.sh installs
4casper-studios avatarvideo-productioncasper-studios/casper-marketplaceVideo downloading, stitching, title slides, and YouTube descriptions. Use this skill when downloading videos from Google Drive, creating title slides, stitching276skills.sh installs
5davila7 avatarfirecrawl-scraperdavila7/claude-code-templatesDeep web scraping, screenshots, PDF parsing, and website crawling using Firecrawl API274skills.sh installs
6tech-leads-club avatarjira-assistanttech-leads-club/agent-skillsManage Jira issues via Atlassian MCP — search, create, update, transition status, and handle sprint tasks. Auto-detects workspace configuration. Use when user s261skills.sh installs