Markdown转Word文档Skill
name: md2word
by cat-xierluo · published 2026-04-01
$ claw add gh:cat-xierluo/cat-xierluo-md2word---
name: md2word
homepage: https://github.com/cat-xierluo/legal-skills
author: 杨卫薪律师(微信ywxlaw)
version: "0.4.1"
license: MIT
description: Markdown转Word文档技能。将Markdown文档转换为符合中文排版标准的专业格式Word文档,支持多种预设格式。适用于正式文档、论文、报告等需要规范排版的文档转换。
---
# Markdown转Word文档Skill
概述
将 Markdown 文档转换为符合中文排版标准的 Word 文档。支持完整的 Markdown 语法,自动应用专业格式设置。
依赖要求
Python 依赖
pip install python-docx Pillow beautifulsoup4 PyYAML可选依赖
npm install -g @mermaid-js/mermaid-cli快速开始
主转换脚本:`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配置系统
内置预设
预设信息从 YAML 文件动态读取,运行以下命令查看完整列表:
python scripts/config.py --list常用预设:
> 完整配置见 `assets/presets/*.yaml`,设计说明见 `assets/theme-notes/`
自定义配置
复制配置模板并修改:
cp assets/config-template.yaml my-config.yamlWord 模板文件
将 `.docx` 模板放入 `assets/templates/` 目录,或使用 `--template` 指定。
**Word 模板 vs 配置文件**:
参考文档
**配置参考**: See [references/config-reference.md](references/config-reference.md)
**使用示例**: See [references/examples.md](references/examples.md)
错误处理
目录结构
md2word/
├── SKILL.md # 本文档
├── CHANGELOG.md # 版本记录
├── STYLE_MAPPINGS.md # 样式映射参考
├── references/ # 参考文档
│ ├── config-reference.md
│ └── examples.md
├── scripts/ # 转换脚本
│ ├── md2word.py # 主脚本
│ ├── config.py # 配置模块(含 --list 查看预设)
│ ├── extract_template_config.py # 从 Word 模板提取配置
│ ├── formatter.py # 文本格式化模块
│ ├── table_handler.py # 表格处理模块
│ └── chart_handler.py # 图表渲染模块
└── assets/ # 资源文件
├── presets/ # YAML 预设配置
├── theme-notes/ # 预设设计说明文档
├── templates/ # Word 模板文件
└── config-template.yamlMore tools from the same signal band
Order food/drinks (点餐) on an Android device paired as an OpenClaw node. Uses in-app menu and cart; add goods, view cart, submit order (demo, no real payment).
Sign plugins, rotate agent credentials without losing identity, and publicly attest to plugin behavior with verifiable claims and authenticated transfers.
The philosophical layer for AI agents. Maps behavior to Spinoza's 48 affects, calculates persistence scores, and generates geometric self-reports. Give your...