mcpField
M
md-to-docx-template

md-to-docx-template

github.com/jonnyschneiderDocuments061 installsUpdated 22w ago
Repository

About md-to-docx-template

md-to-docx-template is a skill for converting Markdown into styled Word documents. It supports custom templates, extracted styles, and multi-file documents assembled from a manifest.

Key features

  1. 01Convert Markdown to DOCX
  2. 02Apply custom reference templates
  3. 03Create templates with chosen fonts and colors
  4. 04Extract styles from branded DOCX files
  5. 05Assemble multi-file documents from a manifest
  6. 06Generate a table of contents

Use cases

  1. 01Turn Markdown content into a Word document
  2. 02Apply an organization's document styling
  3. 03Combine multiple Markdown files into one document

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/jonnyschneider/skills --skill md-to-docx-template

After installing, type/md-to-docx-templatein Claude Code to confirm it loaded.

Bundled files

References and scripts installed along with SKILL.md.

apply-template-styles.py
create-reference-template.py
extract-styles.py
fix-fonts.py
fix-list-indent.py
fix-table-headers.py
md-to-docx.py
README.md

Details

From the project README

Markdown to DOCX with Templates

Convert markdown to professionally styled Word documents. Not plain exports — beautiful, branded documents with your fonts, colors, and table styling applied automatically.

When to Use

  • User wants to convert markdown to Word/DOCX
  • User needs a branded document from markdown source
  • User asks about exporting markdown with styling
  • User mentions "md to docx", "markdown to word", or similar

Prerequisites

  • pandoc installed (brew install pandoc on macOS)
  • Python 3.8+ with packages: python-docx, lxml, click, pyyaml

Installation

Clone this skill's scripts to your preferred location:

git clone https://github.com/jonnyschneider/skills
cd skills/skills/md-to-docx-template
pip install python-docx lxml click pyyaml

Quick Conversion

./md-to-docx.py input.md -o output.docx

With Custom Template

Option A: Generate template with specific fonts/colors
./create-reference-template.py template.docx \
  --font-body "DM Sans" \
  --font-heading "DM Sans" \
  --accent-color "0D494D" \
  --heading-color "0D494D"

./md-to-docx.py input.md -o output.docx --template template.docx
Option B: Extract styles from existing branded document
# Full pipeline for best results:
./extract-styles.py source-branded.docx template.docx
./md-to-docx.py input.md -o output.docx --template template.docx --no-fix-indent
./apply-template-styles.py template.docx output.docx
./fix-table-headers.py output.docx

Multi-file Documents

Create a manifest.yaml:

template: template.docx
output: final-document.docx
sections:
  - 01-intro.md
  - 02-content.md
  - 03-conclusion.md

Then run:

./md-to-docx.py manifest.yaml --open

Key Options

OptionDescription
-o, --outputOutput DOCX path
--templateCustom reference template
--tocGenerate table of contents
--openOpen after building
--no-fix-indentSkip list indent fix (use with extract pipeline)

Template Options

OptionDescription
--font-bodyBody text font (default: Calibri)
--font-headingHeading font (default: Calibri)
--font-monoCode font (default: Consolas)
--accent-colorTable header color (hex, default: 4472C4)
--heading-colorHeading text color (hex, default: 000000)

Limitations

  • Custom fonts must be installed on target machines
  • Complex tables may not render perfectly
  • SVG images require rsvg-convert
  • Some pandoc quirks require post-processing scripts

Comments

Markdown supported