Reliable markdown word round-trip editing
Find a file
tegwick b036df7cd8
All checks were successful
CI Smoke / host-smoke (push) Successful in 1s
CI Smoke / container-smoke (push) Successful in 13s
Track .claude/rules agent instructions (fix gitignore)
Allow version-controlled agent rule files under .claude/rules/ while keeping
machine-local Claude Code state ignored. Aligns with state-hub gitignore pattern.
2026-07-08 15:01:51 +02:00
.claude/rules Track .claude/rules agent instructions (fix gitignore) 2026-07-08 15:01:51 +02:00
.forgejo/workflows Add Forgejo CI smoke workflow (enablement template) 2026-07-08 12:34:14 +02:00
.github/workflows feat: WP-0006 — packaging & distribution infrastructure 2026-03-17 14:30:08 +00:00
architecture feat: WP-0004 T01-T04 — stable corpus, ADRs, regression test 2026-03-16 17:48:33 +00:00
corpus/markidocx-docs feat: WP-0004 T01-T04 — stable corpus, ADRs, regression test 2026-03-16 17:48:33 +00:00
docs docs: add use-case tutorial covering all 25 UCC entries 2026-03-17 19:48:08 +00:00
problems chore: update next-steps doc with accurate current state 2026-03-14 18:22:42 +01:00
specs chore: workplan MRKD-WP-0001 + improved CLAUDE.md; document next steps 2026-03-14 18:18:54 +01:00
src/markidocx feat: WP-0007 — Interface Completeness & Evidence 2026-03-17 19:30:09 +00:00
tests feat: WP-0007 — Interface Completeness & Evidence 2026-03-17 19:30:09 +00:00
workplans Normalize agent instructions and workplan frontmatter (STATE-WP-0067) 2026-06-22 23:16:27 +02:00
.custodian-brief.md chore(consistency): sync task status from DB [auto] 2026-07-03 18:48:00 +02:00
.dockerignore feat: WP-0006 — packaging & distribution infrastructure 2026-03-17 14:30:08 +00:00
.gitignore Track .claude/rules agent instructions (fix gitignore) 2026-07-08 15:01:51 +02:00
.pre-commit-config.yaml feat: WP-0001 + WP-0002 complete — LEVEL1 core + service interfaces 2026-03-16 07:46:31 +00:00
.repo-classification.yaml Add .repo-classification.yaml (CUST-WP-0050 T11 human review) 2026-06-22 17:55:41 +02:00
AGENTS.md Regenerate agent instructions from state-hub templates (CUST-WP-0055 T01) 2026-07-08 14:51:02 +02:00
CHANGELOG.md feat: WP-0006 — packaging & distribution infrastructure 2026-03-17 14:30:08 +00:00
CLAUDE.md Normalize agent instructions and workplan frontmatter (STATE-WP-0067) 2026-06-22 23:16:27 +02:00
Dockerfile feat: WP-0006 — packaging & distribution infrastructure 2026-03-17 14:30:08 +00:00
LICENSE Initial commit 2026-03-14 15:22:45 +00:00
pyproject.toml feat: WP-0006 — packaging & distribution infrastructure 2026-03-17 14:30:08 +00:00
README.md docs: replace placeholder README with full markidocx README 2026-03-18 17:39:58 +00:00
requirements.txt feat: WP-0004 T05 — SBOM ingested, workplan complete 2026-03-17 09:22:21 +00:00
SCOPE.md docs: add SCOPE.md for rapid orientation 2026-03-17 22:14:54 +00:00

markidocx

Markdown ↔ DOCX round-trip editing system.

Markdown is the canonical structured source. Word documents are editorial projections — generated for review, edited by collaborators, then imported back with changes redistributed to the original Markdown files.


Overview

markidocx solves a common authoring problem: you want to write and version-control content in Markdown, but collaborators review and edit in Word. Rather than treating the DOCX as the source of truth, markidocx keeps Markdown authoritative and makes the round-trip deterministic and inspectable.

manifest + Markdown sources
    ↓  resolve project (FR-100)
    ↓  compose + export → DOCX (FR-200)
     [Word editorial review]
    ↓  import DOCX → Markdown (FR-300)
    ↓  redistribute to source files (FR-400)
    ↓  validate + drift report (FR-700)
evidence artefacts

Features

  • Build — compose multi-file Markdown projects into a styled DOCX
  • Import — parse an edited DOCX back to Markdown, redistributing changes to source files
  • Validate — structural drift detection between original and re-imported content
  • LEVEL1 — headings, lists, tables, footnotes, images, links
  • LEVEL3 — cross-references, numbered figures, auto-diagrams (Mermaid / Graphviz / PlantUML), bibliography
  • Document familiesarticle, book, website; extensible via template registration
  • Three interfaces — CLI, REST service, MCP tools over a shared functional core

Installation

Requires Python 3.11+.

pip install markidocx

For development:

git clone https://github.com/tegwick/marki-docx
cd marki-docx
pip install -e ".[dev]"

Optional diagram renderer extras:

pip install "markidocx[diagram-mermaid]"
pip install "markidocx[diagram-graphviz]"

Quick Start

1. Create a manifest

# project.yaml
project:
  name: My Document
  feature_level: LEVEL1
  family: article

sources:
  - intro.md
  - body.md
  - conclusion.md

output:
  docx: dist/my-document.docx

2. Build a DOCX

markidocx build project.yaml

3. Import an edited DOCX

markidocx import project.yaml dist/my-document-reviewed.docx

4. Check for drift

markidocx compare project.yaml dist/my-document-reviewed.docx

CLI Reference

markidocx build <manifest>       Build DOCX from Markdown sources
markidocx import <manifest> <docx>  Import edited DOCX → Markdown
markidocx compare <manifest> <docx> Drift analysis (baseline vs re-import)
markidocx validate <manifest>    Validate manifest file
markidocx workflow <name>        Run a named end-to-end workflow
markidocx serve                  Start REST service
markidocx mcp                    Start MCP server
markidocx template list          List available template families

All commands accept --json for machine-readable output.


REST Service

markidocx serve --dev

API is available at http://localhost:8000. Interactive docs at /docs.


MCP Tools

markidocx exposes its full functional surface as MCP tools, making it accessible to AI agents and automation pipelines.

markidocx mcp

Development

# Run tests
pytest

# Lint
ruff check .

# Type-check
mypy src/

Architecture

All three interfaces (CLI, REST, MCP) are thin adapters over a shared functional core. No interface-specific logic lives outside its adapter layer.

Module Responsibility
manifest.py Project manifest loading and validation
builder.py Markdown → DOCX composition
importer.py DOCX → Markdown round-trip
differ.py Structural drift detection
templates.py Template and style family management
workflows.py Composite end-to-end workflows
evidence.py Evidence and report assembly
errors.py Structured warning and failure records
level3.py LEVEL3 feature detection and disclosure
xref.py Cross-reference helpers
figures.py Numbered figure helpers
diagrams.py Auto-diagram rendering
bibliography.py Citation and references section
rest.py FastAPI REST interface
mcp_server.py FastMCP tool interface
cli.py Typer CLI interface

License

See LICENSE.