Convert Markdown files to Word documents (.docx) with proper formatting, Chinese font support (FangSong for all text including headings), black font color, 1.5x line spacing, precise first-line indent (24pt), heading spacing after (1 line), no italic headings, and automatic superscript conversion for citation numbers. Use when converting .md files to .docx, creating Word documents from markdown, or when user mentions Word, DOCX, or document conversion. Requires pandoc.
Convert markdown files to professionally formatted Word documents (.docx) using pandoc.
This Skill enables Claude to convert Markdown files to Word documents with proper formatting, including:
文献1。 → 文献¹。) to superscript format for academic documentsPackages must be installed in your environment before using this Skill:
pandoc (required):
# macOS
brew install pandoc
# Linux (Debian/Ubuntu)
sudo apt-get install pandoc
# Windows
choco install pandoc
python-docx (required for template creation):
pip install python-docx
Verify pandoc installation:
pandoc --version
When the user requests to convert a Markdown file to Word format:
Check if pandoc is installed by running pandoc --version
Identify the input and output files
report.md, suggest report.docx)Run the conversion script using the Bash tool:
python .claude/skills/md-to-docx/convert_md_to_docx.py input.md output.docx
Use additional options as needed:
--toc for table of contents (default: no TOC)--no-chinese-template if user doesn't want FangSong font--no-superscript-citations to disable automatic citation superscript conversion--reference-doc template.docx for custom styling--title, --author, --date for document metadataFor batch conversions:
python .claude/skills/md-to-docx/convert_md_to_docx.py --batch input_dir/ output_dir/
Verify the conversion succeeded and inform the user of the output location
Default behavior: The script automatically uses a Chinese template with FangSong (仿宋) font for Chinese text unless --no-chinese-template is specified.
Convert a single file (uses default Chinese template):
python .claude/skills/md-to-docx/convert_md_to_docx.py "教育改革方案.md" "教育改革方案.docx"
Convert with table of contents (optional, default is no TOC):
python .claude/skills/md-to-docx/convert_md_to_docx.py report.md report.docx --toc
Convert with metadata:
python .claude/skills/md-to-docx/convert_md_to_docx.py paper.md paper.docx \
--title "研究报告" \
--author "张三" \
--date "2025-11-20"
Batch convert all markdown files:
python .claude/skills/md-to-docx/convert_md_to_docx.py --batch ./markdown_files/ ./word_docs/
Use custom template for organizational styling:
python .claude/skills/md-to-docx/convert_md_to_docx.py doc.md doc.docx \
--reference-doc company_template.docx
This Skill includes additional resources:
"pandoc: command not found"
Images not appearing in output
Table formatting issues
| Header 1 | Header 2 |
|----------|----------|
| Cell 1 | Cell 2 |
Script execution errors
chmod +x convert_md_to_docx.pyWhen converting Chinese documents:
create_chinese_template.py| Option | Description |
|---|---|
input.md | Input Markdown file path |
output.docx | Output Word document path |
--toc | Generate table of contents (default: no TOC) |
--no-chinese-template | Don't use default Chinese font template |
--no-superscript-citations | Don't convert citation numbers to superscript |
--reference-doc FILE | Use custom Word template for styling |
--title TEXT | Set document title metadata |
--author TEXT | Set document author metadata |
--date TEXT | Set document date metadata |
--batch | Enable batch conversion mode |
--pattern PATTERN | File pattern for batch mode (default: *.md) |
The Chinese template automatically applies:
参考文献1。 → 参考文献¹。). Only converts numbers 1-60 that directly follow Chinese characters or letters.--toc to add)For complete documentation, see README.md.