Saturday, November 28, 2026

Markdown to Word without the template tax

Full writeup with reproducible steps: How to convert Markdown to Word (.docx) without templates — knowledge base entry.

Every so often a runbook, note, or tracking doc written in Markdown needs to reach someone who lives in Word. Pandoc works, but the output usually needs a manual cleanup pass — and corporate recipients just want a native .docx.

I packaged the conversion as a Devin/agent skill: simple-md-docx-converter. Feed it any well-formed .md file and it produces a Word document using native constructs — real headings, tables, code blocks, task lists — powered by python-docx. No template file, no placeholder contract to maintain.

  • Headings, lists (incl. task lists), tables, code fences, blockquotes, strikethrough, horizontal rules
  • <mark> highlighting, inline images, {{toc}} fields, page breaks
  • Multi-file merge into a single document
  • Mermaid diagrams render to images when mmdc/Kroki is available, else degrade to labelled text
  • Optional --template (.docx/.dotx or a named template) to inherit corporate styles and fill {{key}} tokens

Quick start:

git clone https://gitlab.com/shoujunni/skill-md-docx-converter.git
cd skill-md-docx-converter
./scripts/setup.sh
.venv/bin/python scripts/convert_md_to_docx.py input.md

The git workflow trick worth stealing: it degrades gracefully — if Mermaid tooling isn't installed, diagrams become clearly-labelled text instead of failing. Source and tests are on GitLab.

Java, JavaScript, HTML, XHTML, AJAX, CSS, etc.