name: markdown-to-docx description: Use when the user wants to convert Markdown to DOCX, make a Microsoft Word version of a Markdown file, style Word output with a reference template, fix DOCX callouts, or customize the bundled Word template for notes, reports, and review docs.
Markdown to DOCX
Converts Markdown files into Microsoft Word documents with Pandoc, a bundled Word reference template, and one post-processing fix that makes wide tables auto-fit more naturally in Word.
When the source Markdown contains Mermaid fenced code blocks, the bundled wrappers also render them to images with Mermaid CLI before Pandoc writes the DOCX.
This skill supports two kinds of work:
- convert Markdown to DOCX with the bundled scripts
- customize Word styling and
custom-stylecallouts in the bundledreference.docx
Quick Start
Use the bundled launcher from this skill directory so installation does not depend on shell execute bits:
macOS/Linux:
python3 scripts/markdown_to_docx.py path/to/file.md
python3 scripts/markdown_to_docx.py path/to/file.md path/to/output.docx
Windows:
py -3 .\scripts\markdown_to_docx.py .\path\to\file.md
py -3 .\scripts\markdown_to_docx.py .\path\to\file.md .\path\to\output.docx
Fallback on macOS/Linux if needed:
bash scripts/pandoc_md_to_docx.sh path/to/file.md
Workflow
- Detect the operating system and choose:
scripts/markdown_to_docx.pyas the preferred launcherscripts/pandoc_md_to_docx.shon macOS/Linux when direct script invocation is neededscripts/pandoc_md_to_docx.ps1on Windows when direct PowerShell invocation is needed
- Verify that
pandocis installed before attempting conversion. - If the user did not provide an output path, let the script write
<input>.docxnext to the source Markdown file. - Use the bundled
scripts/reference.docxas the Word template. - If the user wants callouts or special formatting, confirm that the corresponding custom style exists in the template.
- If the user wants the callout look or typography changed, edit
scripts/reference.docxrather than trying to fake the styling in Markdown. - If the Markdown contains Mermaid code fences, make sure
mmdcfrom@mermaid-js/mermaid-cliis installed or available throughMERMAID_MMDC.
Callout Guidance
Pandoc custom-style blocks only render with special Word styling when the style exists in scripts/reference.docx.
Current bundled callout styles include:
NoteTipImportantWarningRiskCautionInfoBoxDecisionOpen Question
When the user asks to add or fix callouts:
- keep the Markdown block in the form
::: {custom-style="Style Name"} - make sure the style name matches Word exactly
- edit the bundled
reference.docxif the style is missing or needs different colors, borders, or spacing
Dependencies
pandocis required on every platform- macOS/Linux also need
perl,zip, andunzip - Mermaid diagrams require
mmdcfrom@mermaid-js/mermaid-cli - Windows relies on built-in PowerShell archive commands
References
Open only what you need:
references/quick-usage.mdfor direct conversion commands and expected behaviorreferences/callout-styles.mdfor style names and Markdown examplesreferences/troubleshooting.mdfor missing-tool and template issues