markdown-to-docxlisted
Install: claude install-skill desmondc9/agent-skills
# Markdown → DOCX Conversion
Converts any Markdown file to a professionally formatted Word document (.docx) using a bundled Python pipeline: **pandoc** + **mmdc** (Mermaid CLI) + **python-docx** post-processing.
## What This Skill Does
1. **Pre-processes Markdown** — strips any manually written `## Table of Contents` section, injects TOC placeholder strings after the first `---` separator (i.e., right after the document header block: title + metadata + `---`)
2. **Renders Mermaid diagrams** — finds every ` ```mermaid ` fenced block, renders each to a high-resolution PNG (2400 px wide, 3× scale), and replaces the block with an image reference
3. **Converts with pandoc** — produces the base `.docx` from the processed Markdown
4. **Post-processes the DOCX** — replaces the TOC placeholders with a native Word TOC field (`{ TOC \o "1-3" \h \z \u }`) and applies table formatting (dark header row, alternating row shading, cell borders)
## Usage
```bash
python <skill-scripts-path>/convert_markdown_to_docx.py <input.md> [output.docx]
```
- `input.md` — path to the Markdown file (required)
- `output.docx` — output path (optional; defaults to `<input>.docx`)
**Example:**
```bash
python ~/.claude/skills/markdown-to-docx/scripts/convert_markdown_to_docx.py solution.md
python ~/.claude/skills/markdown-to-docx/scripts/convert_markdown_to_docx.py docs/report.md docs/report.docx
```
## How to Run for the User
When the user asks to convert a markdown file:
1. Identify the input file p