md-to-word

Convert Markdown documents with Mermaid diagrams into formatted Word docx files.

Updated Mar 8, 2026
One-click install
npx skills add https://github.com/fabioc-aloha/BrainBenchmark --skill md-to-word-fabioc-aloha
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: md-to-word
Source: https://github.com/fabioc-aloha/BrainBenchmark/tree/main/.github/skills/md-to-word
Command: npx skills add https://github.com/fabioc-aloha/BrainBenchmark --skill md-to-word-fabioc-aloha

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires pandoc, mermaid-cli, python-docx, svgexport.

What problem does it solve? Markdown documents with Mermaid diagrams, tables, and SVG images do not translate cleanly into Word format, leaving diagrams unrendered, tables unstyled, and images overflowing page boundaries when shared with stakeholders. ## Core Features & Use Cases - Mermaid to PNG Rendering: Automatically renders Mermaid diagrams (Gantt, flowchart, sequence, class, ER, pie) to PNG images sized to fit 90% of the page bounds. - Professional Table Styling: Applies Microsoft blue headers, alternating row colors, borders, and smart pagination so tables never split awkwardly across pages. - Markdown Preprocessing: Fixes bullet list spacing, checkbox syntax, and converts SVG banners to PNG before pandoc conversion. - Use Case: You have a technical specification in Markdown with architecture flowcharts and a Gantt chart. Run the script to produce a polished .docx ready for executive review, then save as PDF from Word. ## Quick Start Ask the AI to convert your Markdown file, such as docs/spec.md, into a Word document using the md-to-word script.

Frequently Asked Questions about md-to-word

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I convert Markdown with Mermaid diagrams to Word?▼

Run the md-to-word.py script on your Markdown file, for example: python .github/muscles/md-to-word.py docs/spec.md. It renders Mermaid diagrams to PNG via mermaid-cli, then uses pandoc to generate the docx with styled tables and centered images.

What tools are required for Markdown to Word conversion?▼

You need pandoc for Markdown-to-docx conversion, mermaid-cli (mmdc) for rendering diagrams to PNG, and python-docx for table formatting. Optionally install svgexport to convert SVG banners to PNG.

Does the conversion support Mermaid diagram types like Gantt and flowcharts?▼

Yes, it supports Gantt, flowchart (LR and TB), sequence, class, ER, and pie diagrams. Each type gets an appropriate sizing strategy, with wide diagrams constrained by width and tall diagrams by height.

Why are my Mermaid diagrams overflowing the Word page?▼

Older script versions did not constrain image size. Version 2.0.0 reads actual PNG dimensions and scales images to 90% of usable page bounds in both width and height, preserving aspect ratio.

Why is mmdc not found when running the conversion?▼

The mmdc command comes from mermaid-cli, which is not installed or not in your PATH. Install it globally with npm install -g @mermaid-js/mermaid-cli, then retry the conversion.

Can the script generate a PDF directly from Markdown?▼

No, the script only produces the Word document. The recommended workflow is to open the docx in Word, make final layout adjustments, and use Save As PDF for full rendering fidelity and font embedding.