Skip to main content

mddocx

PyPI Python CI Release License: MIT

Deterministic Markdown-to-DOCX compilation for professional, editable Microsoft Word documents.

mddocx converts Markdown into native Word structures instead of screenshots or flattened pages. Headings, lists, tables, equations, charts, links, references, footnotes, headers, footers, and other document elements remain editable in Microsoft Word.

What it does

  • Converts Markdown files or strings into native DOCX documents.
  • Preserves editable Word headings, paragraphs, lists, tables, hyperlinks, and code blocks.
  • Supports nested lists, task lists, blockquotes, callouts, page breaks, and section breaks.
  • Produces editable Word equations using OMML rather than images.
  • Creates editable Office charts backed by embedded Excel workbooks.
  • Supports CSV and JSON data for charts and native Word tables.
  • Handles images, captions, bookmarks, cross-references, footnotes, endnotes, and citations.
  • Supports themes, fonts, templates, right-to-left text, headers, footers, tables of contents, and page fields.
  • Provides project mode for compiling multiple Markdown chapters into one document.
  • Includes diagnostics, document inspection, accessibility checks, and profiling utilities.
  • Provides privacy-aware metadata handling for exported AI/chat conversations.

Installation

mddocx requires Python 3.11 or newer.

Install from PyPI

The distribution is published as mddocx-native; the Python import and command remain mddocx:

python -m pip install --upgrade mddocx-native

Verify the installation:

mddocx --version
mddocx doctor

Install a downloaded wheel

Download the .whl file from the latest GitHub Release, open a terminal in the download directory, and run:

python -m pip install ./mddocx_native-1.2.1-py3-none-any.whl

On Windows PowerShell, the equivalent command is:

python -m pip install .\mddocx_native-1.2.1-py3-none-any.whl

You can also install the wheel directly from the v1.2.1 GitHub Release:

python -m pip install "https://github.com/TasinAhmed2508/mddocx/releases/download/v1.2.1/mddocx_native-1.2.1-py3-none-any.whl"

Install from GitHub

python -m pip install "git+https://github.com/TasinAhmed2508/mddocx.git@v1.2.1"

Install for local development

git clone https://github.com/TasinAhmed2508/mddocx.git
cd mddocx
python -m pip install -e ".[dev]"

Optional features:

python -m pip install "mddocx-native[math]"
python -m pip install "mddocx-native[images]"
python -m pip install "mddocx-native[math,images]"

Quick start

Create a file named report.md:

# Quarterly Report

## Summary

This report is generated from Markdown and remains fully editable in Word.

| Metric | Value |
| --- | ---: |
| Revenue | 125,000 |
| Growth | 18% |

Convert it to Word:

mddocx report.md -o report.docx

Command-line interface

mddocx document.md -o document.docx
mddocx document.md --theme academic
mddocx document.md --template company.docx
mddocx document.md --toc --page-numbers
mddocx document.md --header "Project Report" --footer "Confidential"
mddocx document.md --diagnostics-json diagnostics.json
mddocx inspect document.docx --strict
mddocx accessibility document.docx --strict
mddocx doctor
mddocx api --json

For multi-file document projects:

mddocx project init report
mddocx build report
mddocx project info report
mddocx watch report

For interactive use:

mddocx shell

Run mddocx --help for the complete command reference.

Python API

from mddocx import RenderConfig, render, render_string

render("report.md", "report.docx")

config = RenderConfig(theme="modern")
document = render_string("# Generated report\n\nEditable Word content.", config=config)

with open("generated.docx", "wb") as file:
    file.write(document)

The public API is documented in docs/API_STABILITY.md and can also be inspected with mddocx api --json.

YAML front matter

Document settings can be defined at the top of a Markdown file:

---
title: Research Report
author: Example Author
theme: academic
toc: true
page_numbers: true
auto_landscape_tables: true
header: Research Group
footer: Confidential
---

Privacy and security defaults

  • Remote resources are disabled by default.
  • HTTPS image downloads can be explicitly enabled and restricted by domain.
  • Local resource paths cannot escape the document or project directory.
  • Download size, MIME type, redirects, and network destinations are constrained.
  • SVG parsing rejects external references and uses hardened XML handling.
  • Code blocks and TeX are never executed.
  • AI/chat export metadata is removed conservatively before Markdown parsing when enabled.

Project layout

mddocx/
├── src/mddocx/        # Package source code
├── docs/              # User and technical documentation
├── dist/              # Local build output, when generated
├── .github/workflows/ # CI and release automation
├── pyproject.toml     # Package metadata and build configuration
└── README.md          # Project overview and usage guide

Documentation

Detailed documentation is available in the docs directory, including compatibility, API stability, interactive CLI, charts and data, AI export metadata, accessibility, and extensions.

Releases

Release builds are generated by GitHub Actions. Each versioned release publishes the wheel and source archive as downloadable GitHub Release assets.

License

Released under the MIT License.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mddocx_native-1.2.1.tar.gz (131.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mddocx_native-1.2.1-py3-none-any.whl (152.4 kB view details)

Uploaded Python 3

File details

Details for the file mddocx_native-1.2.1.tar.gz.

File metadata

  • Download URL: mddocx_native-1.2.1.tar.gz
  • Upload date:
  • Size: 131.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mddocx_native-1.2.1.tar.gz
Algorithm Hash digest
SHA256 2324c0e0feb33d886f8b985da4e9fec15b885ec9f038740d78dbd2af7fb68cd5
MD5 5518448704a3df726b8dbfc5980825c9
BLAKE2b-256 0502b3d747dc508c593c7a25273f5957a47d2d581fb02bc5ef23a9f5868542fb

See more details on using hashes here.

Provenance

The following attestation bundles were made for mddocx_native-1.2.1.tar.gz:

Publisher: release.yml on TasinAhmed2508/mddocx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file mddocx_native-1.2.1-py3-none-any.whl.

File metadata

  • Download URL: mddocx_native-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 152.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for mddocx_native-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ce92823fac5716e9b7ba995efff8e19461eebb60c76174926c738f4fd4227adc
MD5 43a9c7a57c03a650f43031f5ffecaf84
BLAKE2b-256 9ce3993c6d52e7cec4b51e9e22a9ae4276267312171b582187609c4ed67e53ee

See more details on using hashes here.

Provenance

The following attestation bundles were made for mddocx_native-1.2.1-py3-none-any.whl:

Publisher: release.yml on TasinAhmed2508/mddocx

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

1.2.4

2 files

1.2.3

2 files

1.2.2

2 files

This release

1.2.1 This release

2 files

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