Skip to main content

AI-native, agent-friendly markdown to DOCX compiler for polished editable docs, Google Docs handoff, and PDF-ready workflows.

Project description

markdown-docx-compiler

CI PyPI version Python 3.11+ License: MIT Agent-friendly CLI

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 .docx for 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 --json output fit deep research, canvas-style drafting, and automated reporting workflows.

Ideal Workflow

  1. An agent or human drafts a report, memo, proposal, launch brief, or design review in markdown.
  2. A sidecar file applies reusable layout and styling without polluting the source markdown.
  3. mdc doc create compiles the document into polished, editable DOCX.
  4. A human makes the final judgment calls in Word or Google Docs.
  5. The finished DOCX can be exported to PDF as the final delivery format.

Samples

Explore complete example document projects in the repository:

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 inherits for reusable document defaults
  • Deterministic table, footer, and page-level styling
  • Google Docs optimized — import fidelity is the primary target
  • Agent-friendly CLI with --json output 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 report.docx next to report.md.

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 -->
![Acme Logo](./logo.png)

<!-- 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 doc --help or mdc spec --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

Project details


Download files

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

Source Distribution

markdown_docx_compiler-0.1.1.tar.gz (6.7 MB view details)

Uploaded Source

Built Distribution

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

markdown_docx_compiler-0.1.1-py3-none-any.whl (52.6 kB view details)

Uploaded Python 3

File details

Details for the file markdown_docx_compiler-0.1.1.tar.gz.

File metadata

  • Download URL: markdown_docx_compiler-0.1.1.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

Hashes for markdown_docx_compiler-0.1.1.tar.gz
Algorithm Hash digest
SHA256 e6f9c2c197991fba5eb007a93341ecfbddd192245c197d45b948ba5899cb19c6
MD5 e77ec83a2c679d4683c5442077dec9c5
BLAKE2b-256 072730092fde6bc79317bbb977f215fc6804c097f1389865326501da54e80663

See more details on using hashes here.

Provenance

The following attestation bundles were made for markdown_docx_compiler-0.1.1.tar.gz:

Publisher: publish.yml on zequn-fireworks/markdown-docx-compiler

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

File details

Details for the file markdown_docx_compiler-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for markdown_docx_compiler-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 6ede6e5aa33c693ec131b7942b5b218d07ee5265002f13b3a9507859bd9f5932
MD5 f04a4a39762351861811257df220e196
BLAKE2b-256 6fd928e6f2584278319b958d674a82c4f08e3b8b9e741f2a5b45a83d93876fd1

See more details on using hashes here.

Provenance

The following attestation bundles were made for markdown_docx_compiler-0.1.1-py3-none-any.whl:

Publisher: publish.yml on zequn-fireworks/markdown-docx-compiler

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page