AI-native, agent-friendly markdown to DOCX compiler for polished editable docs, Google Docs handoff, and PDF-ready workflows.
Project description
markdown-docx-compiler
Readable markdown in, polished DOCX out.
markdown-docx-compiler is an AI-native, agent-friendly document compiler
that turns readable markdown into polished, editable .docx files optimized
for Google Docs import, final human adjustments, and easy PDF export.
Why It Exists
- Readable source for agents and humans - keep documents mostly vanilla markdown instead of burying formatting in HTML or template-only syntax.
- Small sidecars, large rendering gains - move layout and styling into reusable YAML sidecars so the marginal LOC stays low while the rendered result looks much better.
- DOCX as the collaboration surface - compile into polished
.docxfor final edits in Word or Google Docs instead of treating the output as a dead render. - PDF-ready last mile - once the DOCX looks right, exporting to PDF with LibreOffice, Word, or your preferred tool is straightforward.
- Agent-friendly CLI - noun-verb commands and
--jsonoutput fit deep research, canvas-style drafting, and automated reporting workflows.
Ideal Workflow
- An agent or human drafts a report, memo, proposal, launch brief, or design review in markdown.
- A sidecar file applies reusable layout and styling without polluting the source markdown.
mdc doc createcompiles the document into polished, editable DOCX.- A human makes the final judgment calls in Word or Google Docs.
- The finished DOCX can be exported to PDF as the final delivery format.
Samples
Explore complete example document projects in the repository:
goggle-offer/- fictionalized offer letter with a logo header, doc header slots, and compensation table. Markdown, Sidecar, PDF previewbasethree-design-review/- fictionalized inference company design review with a shaded summary, decision matrix, risk register, and appendix page break. Markdown, Sidecar, PDF previewopena1-launch-brief/- fictionalized bilingual launch brief with centered title styling, editorial callouts, and compact tables. Markdown, Sidecar, PDF preview
Company names in the examples are intentionally fictionalized to avoid trademark issues.
Features
- Plain markdown with optional
docx:tags for regions and block anchors - Sidecar config for layout control (fonts, colors, column widths, per-block styling)
- Composable sidecars via
inheritsfor reusable document defaults - Deterministic table, footer, and page-level styling
- Google Docs optimized — import fidelity is the primary target
- Agent-friendly CLI with
--jsonoutput for tool integration - Document-first workflow for research reports, design docs, launch briefs, internal memos, and final editable handoff
Quick start
pip install markdown-docx-compiler
# or install the CLI with uv / pipx
uv tool install markdown-docx-compiler
pipx install markdown-docx-compiler
Verify the install:
mdc --help
Compile a document:
mdc doc create report.md -o report.docx
With a sidecar config:
mdc doc create report.md --spec report.docx.yaml -o report.docx
If -o is omitted, the compiler writes <input>.docx next to the markdown
file.
The compiler itself is DOCX-first. PDF export is typically the downstream step once the generated DOCX is approved.
How it works
Write standard markdown with optional YAML front matter for document-level defaults:
---
title: Offer of Employment
font: Arial
text_color: "202124"
---
<!-- docx:doc_header.left -->

<!-- docx:page_footer.center -->
2026-03-19
# Offer of Employment
Dear **Jordan Chen**, ...
## Compensation
<!-- docx:id=comp-table -->
| Component | Details |
| --- | --- |
| Base Salary | $218,000 per year |
| Equity (RSUs) | 1,400 shares over 4 years |
Place a sidecar YAML next to it for styling:
document:
font: { family: Arial, size: 10.5, color: "202124" }
page:
margin: { top: 0.8, bottom: 0.75, left: 1.0, right: 1.0 }
page_footer:
font: { size: 8, color: "5F6368" }
defaults:
paragraph:
spacing: { after: 6, line: 1.15 }
blocks:
comp-table:
type: table
table: { columns: [1fr, 3fr] }
Run mdc doc create offer.md -o offer.docx and you get a fully styled document.
Front matter only controls document-level metadata, font, link, and page
settings. Use region tags for header/footer content, and use blocks: anchors
for body block overrides, including blocks inside list items.
The important workflow property is that the source markdown stays readable enough for LLMs and humans to keep editing directly, while the sidecar carries the presentational complexity.
CLI reference
mdc doc create report.md -o report.docx # compile
mdc doc validate report.md # dry-run parse
mdc spec show --for report.md --resolved # inspect merged config
mdc spec create report.docx.yaml # scaffold a sidecar
Use --json with any command for machine-readable output.
Run mdc <noun> --help for detailed reference documentation.
Development
uv sync
uv run ruff check src/ tests/
uv run ruff format --check src/ tests/
uv run mypy src/
uv run pytest tests/
uv build
uvx twine check dist/*
Docs
- Users and agents:
mdc <noun> --help(e.g.mdc doc --help,mdc spec --help) - Maintainers:
AGENTS.md - Release process:
RELEASING.md - Examples:
examples/
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file markdown_docx_compiler-0.1.0.tar.gz.
File metadata
- Download URL: markdown_docx_compiler-0.1.0.tar.gz
- Upload date:
- Size: 6.7 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3383c4b967d98bc2309580a016779c7b2b5926c7d77ffa6efe2f1b4f656ad276
|
|
| MD5 |
26ed3ae55451fc569d7836a89d4e202c
|
|
| BLAKE2b-256 |
db23bd4cb4fdf004832777218a538cc4dc1950e7d96d26e2fe71fa967cef9645
|
Provenance
The following attestation bundles were made for markdown_docx_compiler-0.1.0.tar.gz:
Publisher:
publish.yml on zequn-fireworks/markdown-docx-compiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
markdown_docx_compiler-0.1.0.tar.gz -
Subject digest:
3383c4b967d98bc2309580a016779c7b2b5926c7d77ffa6efe2f1b4f656ad276 - Sigstore transparency entry: 1145966700
- Sigstore integration time:
-
Permalink:
zequn-fireworks/markdown-docx-compiler@2970b6850ee70e139ee85b9d08952359a2f5c07a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/zequn-fireworks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2970b6850ee70e139ee85b9d08952359a2f5c07a -
Trigger Event:
release
-
Statement type:
File details
Details for the file markdown_docx_compiler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: markdown_docx_compiler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 52.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95137b3da25bfc6046ab5ef3a81f82287742127c825eb7228b634b55840801f3
|
|
| MD5 |
252488905730435fcb27a06d6b4ddef6
|
|
| BLAKE2b-256 |
f9e3601777068d0b2f99b6da1ff275342ed601c6f0325cd49303e510c64504fb
|
Provenance
The following attestation bundles were made for markdown_docx_compiler-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on zequn-fireworks/markdown-docx-compiler
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
markdown_docx_compiler-0.1.0-py3-none-any.whl -
Subject digest:
95137b3da25bfc6046ab5ef3a81f82287742127c825eb7228b634b55840801f3 - Sigstore transparency entry: 1145966774
- Sigstore integration time:
-
Permalink:
zequn-fireworks/markdown-docx-compiler@2970b6850ee70e139ee85b9d08952359a2f5c07a -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/zequn-fireworks
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@2970b6850ee70e139ee85b9d08952359a2f5c07a -
Trigger Event:
release
-
Statement type: