Convert Markdown to professional DOCX documents — dependency-free, no Word or Pandoc required.
Built in Go. Distributed as a single static binary with no runtime dependencies.
English | 简体中文 | 日本語 | 한국어 | Español | Português | Deutsch | Français
md2docxA terminal UI with arrow-key navigation:
- Select Markdown input file
- Choose output location and filename
- Pick a built-in style preset (US, CN, JP, EU, KR, Academic) or a custom JSON template
- Confirm and convert
# Convert with defaults
md2docx convert -i notes.md -o notes.docx --json
# Convert with a country-specific preset
md2docx convert -i report.md -o report.docx -s cn-official --json
# List all presets
md2docx presets --json
# Create a custom template from a preset
md2docx template create -o my-style.json -s jp-formal
# Convert with a custom template
md2docx convert -i doc.md -o doc.docx -s my-style.json --json
# Convert with Mermaid diagrams rendered as embedded PNG images
md2docx convert -i doc.md -o doc.docx --mermaid --json
md2docx convert -i doc.md -o doc.docx --mermaid --mermaid-theme dark --jsonThe --json flag produces structured JSON suitable for agent consumption:
{"success": true, "outputPath": "/path/to/output.docx", "bytes": 12345}go install github.com/Aknirex/md2docx/cmd/md2docx@latestDownload from GitHub Releases for:
- Linux (amd64, arm64)
- macOS (amd64, arm64)
- Windows (amd64)
# Homebrew
brew install md2docx/homebrew-tap/md2docx
# Debian/Ubuntu
dpkg -i md2docx_*.deb
# RPM
rpm -i md2docx_*.rpm| Preset | Region | Fonts |
|---|---|---|
| us-business | US | Cambria / Calibri / Consolas |
| us-modern | US | Segoe UI / Cascadia Code |
| cn-official | China | 小标宋_GBK / 仿宋_GB2312 / 楷体_GB2312(公文风格) |
| cn-modern | China | Noto Sans SC / Noto Sans Mono SC |
| jp-formal | Japan | Yu Mincho / Yu Gothic |
| eu-clean | Europe | Helvetica / Arial / Fira Code |
| kr-standard | Korea | Malgun Gothic / Nanum Gothic / D2Coding |
| academic | Global | Times New Roman / Courier New |
| default | Global | Aptos Display / Cascadia Mono |
md2docx includes a SKILL.md so AI coding agents (Kilo, Claude Code, etc.) can discover and invoke it automatically.
Install via npx skills:
npx skills add Aknirex/md2docxAfter installation, agents will know how to invoke md2docx convert -i <input> -o <output> --json for markdown-to-docx conversions.
Custom style templates are JSON files:
{
"titleFont": "Arial",
"titleSize": 28,
"headingFont": "Arial",
"headingSize": 16,
"bodyFont": "Times New Roman",
"bodySize": 12,
"codeFont": "Courier New",
"codeSize": 10,
"textColor": "#1F2937",
"accentColor": "#2563EB",
"pageMarginInches": 1.0
}Create one from a preset:
md2docx template create -o my-style.json -s default- Headings (h1–h6)
- Paragraphs
- Unordered lists (
-,+,*) - Ordered lists (
1.,1)) - Blockquotes (
>) - Fenced code blocks (
```) - Bold, italic,
inline code
Mermaid code blocks are rendered as embedded PNG images when --mermaid is enabled:
```mermaid
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Do this]
B -->|No| D[Do that]
```Uses mermaid.ink by default (public, free API). Configure with:
--mermaid— enable Mermaid rendering--mermaid-theme—default,neutral,dark, orforest--mermaid-server— custom self-hosted mermaid.ink instance
In the TUI, toggle Mermaid rendering on the confirm screen.
git clone https://github.com/Aknirex/md2docx
cd md2docx
go mod tidy
make buildMIT