Skip to main content

Markdown to Word (.docx)

Turn Markdown files into Microsoft Word documents—images, links, tables, and code included.

CI PyPI version License: MIT


Quick start

pip install "pandoc-md-to-docx[binary]"
md-to-docx your-notes.md --force

This creates your-notes.docx next to your Markdown file. The [binary] extra bundles Pandoc so you do not need a separate Pandoc install.


What this tool does

md-to-docx converts .md files to .docx using Pandoc. It wraps Pandoc with sensible defaults for everyday use:

You get How
One command per file or many Pass paths on the command line, or pick files in a terminal menu (macOS/Linux)
Sensible defaults Output name matches the input (report.md → report.docx)
Safe overwrites Prompts in the terminal, or --force / --skip-existing for scripts
GitHub READMEs --from gfm for GitHub-flavored Markdown
Word that looks intentional Built-in style template (--reference-doc bundled) and optional table of contents

Ideal for documentation, notes, specs, and READMEs you need to share as Word.


Why use this instead of copy-paste or Pandoc alone?

  • Copy-paste from VS Code or GitHub often breaks tables, code blocks, and images. This produces a real .docx with embedded assets.
  • Raw pandoc commands are easy to forget (--resource-path, reference doc, TOC flags). This tool sets the important defaults—especially where to look for images.
  • Batch and automation — convert many files, set an output folder, and use exit codes in scripts.

Local images

![Architecture diagram](./images/architecture.png)

For each input file, paths are resolved from that file’s directory, not from where you run the command. Keep images beside the .md file (e.g. docs/guide.md and docs/images/...).

![Logo](https://example.com/logo.png)
[Project site](https://example.com)

HTTPS images are fetched when Pandoc can reach them. Markdown links become clickable links in Word.

For edge cases and limits, see Limitations on GitHub.


Installation

pip install "pandoc-md-to-docx[binary]"
Extra Purpose
[binary] Bundled Pandoc (recommended)
(none) You must install Pandoc yourself

Requirements: Python 3.9+


Usage examples

md-to-docx notes.md
md-to-docx notes.md -o ~/Desktop/report.docx --force
md-to-docx README.md --from gfm --reference-doc bundled --force
md-to-docx ch1.md ch2.md -d ./word-output --skip-existing
md-to-docx spec.md --toc --toc-depth 3 --reference-doc bundled --force

Interactive mode (macOS / Linux)

md-to-docx       # .md files in current directory
md-to-docx -r    # include subdirectories

Use ↑/↓, Space to select, Enter to convert, Esc to cancel. On Windows, pass file paths on the command line instead.


Command reference

Option Description
-o, --output Output .docx path (single input only)
-d, --output-dir Directory for output files (batch)
-f, --force Overwrite existing output without prompting
--skip-existing Skip if output already exists
--rename-on-exists Write name (1).docx, etc.
--from Input format: markdown, gfm, commonmark, …
--reference-doc Path to style template, or bundled
--toc Add a table of contents
--toc-depth N Heading levels included in TOC
-r, --recursive Scan subfolders (interactive mode only)
--version Print version and exit

Help and feedback

License

MIT — see LICENSE.

Metadata

Release files for pandoc-md-to-docx 0.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pandoc-md-to-docx 0.2.4
File Size Uploaded Provenance
pandoc_md_to_docx-0.2.4.tar.gz 23.7 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pandoc-md-to-docx 0.2.4
File Interpreter ABI Platform
pandoc_md_to_docx-0.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 44.1 kB

Release files / pandoc_md_to_docx-0.2.4.tar.gz

Download URL pandoc_md_to_docx-0.2.4.tar.gz
Size 23.7 kB
Tags Source
SHA-256 checksum
How to use checksums
43616d729478e9512e4e795daa8b93a782dfcb0b6f39f5ffc8beaae812b5e59d
BLAKE2b-256 checksum
How to use checksums
671d53af9bf1458ee8f11bc7be84c9d580647b7856da38fb6ef56d0dcb71d87d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Release files / pandoc_md_to_docx-0.2.4-py3-none-any.whl

Download URL pandoc_md_to_docx-0.2.4-py3-none-any.whl
Size 20.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d85fa55ef16e2d443e80826dee6df714234213fddde56790f3cdc9e42b9decd7
BLAKE2b-256 checksum
How to use checksums
0355898d517b6ae68976c59d1e0ecbd1184f44f5a5109f60a2c45fee3573c5cc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.7

Security for pandoc-md-to-docx 0.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page