Now liveThe Skillselion MCP - thousands of ranked skills, loaded into your agent mid-task. No install.Get it →
cat-xierluo avatar

Md2word

  • 174 installs
  • 543 repo stars
  • Updated August 5, 2026
  • cat-xierluo/legal-skills

Convert agent-authored Markdown memos, policies, and briefs into Word files counsel and clients can redline, comment on, and circulate.

About

md2word from cat-xierluo/legal-skills converts Markdown legal drafts into Word documents with usable structure for review. It closes the gap between agent-generated memos in repos and the DOCX files lawyers expect for comments, redlines, and client distribution.

  • Markdown to DOCX conversion
  • Preserves headings and lists
  • Supports legal memo handoff
  • Enables Word track-changes workflow
  • Bridges agent output to Office

Md2word by the numbers

  • 174 all-time installs (skills.sh)
  • Ranked #271 of 688 Office & Documents skills by installs in the Skillselion catalog
  • Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/cat-xierluo/legal-skills --skill md2word

Add your badge

Show developers this skill is listed on Skillselion. Paste this into your README.

Listed on Skillselion
Installs174
repo stars543
Last updatedAugust 5, 2026
Repositorycat-xierluo/legal-skills

What it does

Convert agent-authored Markdown memos, policies, and briefs into Word files counsel and clients can redline, comment on, and circulate.

Files

SKILL.mdMarkdownGitHub ↗

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

常用预设:

  • legal — 法律文书格式(默认)
  • service-plan — 法律服务方案(含分层配色)
  • minimal — 极简格式
  • academic — 学术论文格式
  • report — 工作报告格式
完整配置见 assets/presets/*.yaml,设计说明见 assets/theme-notes/

自定义配置

复制配置模板并修改:

cp assets/config-template.yaml my-config.yaml

Word 模板文件

.docx 模板放入 assets/templates/ 目录,或使用 --template 指定。

Word 模板 vs 配置文件

  • Word 模板:控制视觉元素(页眉、页脚、Logo)
  • 配置文件:控制格式参数(字号、行距、页边距)

参考文档

  • 配置参考: references/config-reference.md
  • 样式映射: references/style-mappings.md
  • 使用示例: references/examples.md

错误处理

  • 文件编码:自动检测 UTF-8 和 GBK
  • 模板找不到:使用默认格式创建新文档
  • Mermaid 失败:降级为文本描述
  • 图片过大:自动压缩和调整尺寸

目录结构

md2word/
├── SKILL.md               # 本文档
├── CHANGELOG.md           # 版本记录
├── references/            # 参考文档
│   ├── config-reference.md
│   ├── style-mappings.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.yaml

Related skills

Office & Documentsworkflownotes

This week in AI coding

Five minutes, every Monday - the tools, releases and tactics for developers.

unsubscribe anytime.