Lossless DOCX <-> Markdown conversion preserving Word comment threads
Project description
docx-md-comments
Takes word documents with comment threads and converts them to markdown that is easily readable by LLMs and humans. The markdown documents can be backconverted into .docx files with nested comment threads fully restored.
Lossless .docx <-> .md comments conversion:
- comment anchors
- threaded replies
- active/resolved state
If your workflow is "convert .docx with comments --> edit in markdown using LLMs --> return to Word, restoring remaining (or new) comments or LLM comments", this tool is for that.
Install
Prerequisites
- Python 3.10+
- Pandoc available on
PATH
Install Pandoc:
- macOS:
brew install pandoc - Ubuntu/Debian:
sudo apt-get install pandoc - Windows (PowerShell):
choco install pandoc -y
Recommended (isolated): pipx
pipx install docx-md-comments
Upgrade later:
pipx upgrade docx-md-comments
Alternative: pip
python -m pip install docx-md-comments
Quick usage
DOCX -> MD (all of these are equivalent):
dmc draft.docx
docx-comments draft.docx
docx2md draft.docx
d2m draft.docx
MD -> DOCX (all of these are equivalent):
dmc draft.md
docx-comments draft.md
md2docx draft.md
m2d draft.md
Explicit mode
DOCX -> Markdown:
docx2md draft.docx -o draft.md
d2m draft.docx -o draft.md
dmc docx2md draft.docx -o draft.md
Markdown -> DOCX:
md2docx draft.md -o draft.docx
m2d draft.md -o draft.docx
dmc md2docx draft.md -o draft.docx
Use a reference Word document for styling:
md2docx draft.md --ref original.docx -o final.docx
m2d draft.md -r original.docx -o final.docx
--ref maps to Pandoc --reference-doc.
Pass-through Pandoc arguments
Unknown flags are passed through to Pandoc:
docx2md draft.docx -o draft.md --extract-media=media
dmc md2docx draft.md --reference-doc=template.docx
Limitations
- Tracked Changes: Word "Tracked Changes" (revisions) are not (yet) preserved through the roundtrip. They are accepted (merged) during the DOCX to Markdown conversion. It is recommended to handle (accept/reject) all tracked changes in Word before conversion, while leaving comments as needed so they can be addressed in Markdown (e.g., by an LLM).
- Formatting: While Pandoc handles most formatting, the primary focus of this tool is the lossless conversion of comment threads. Complex layouts or advanced Word features may not always roundtrip perfectly if they are not supported by the Markdown intermediate format.
Help
dmc --help
docx2md --help
md2docx --help
Testing
Run full suite:
make test
Roundtrip-focused tests only:
make test-roundtrip
make test also writes:
artifacts/out_test.mdartifacts/out_test.docx
Report issues
Please open bugs/feature requests at:
https://github.com/Pascal-Kueng/docx-md-comments/issues
When reporting a conversion bug, include:
- input sample (or minimal repro)
- command used
- expected vs actual behavior (Word view)
- failing
failure_bundlepath if tests failed
Technical notes (brief)
- Markdown marker style uses
///C<ID>.START///////C<ID>.END///(with optional==...==highlight wrapper). - Reply relationships are reconstructed as native Word threads (
commentsExtended.xmlparaIdParent+ story markers). - The validator fails fast on malformed marker edits with line-specific diagnostics.
For deeper maintainer details, see AGENTS.md.
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 docx_md_comments-1.0.0.tar.gz.
File metadata
- Download URL: docx_md_comments-1.0.0.tar.gz
- Upload date:
- Size: 54.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d2902ce87faa2a535a67f05673866d6cad4b5dc30524bdc0d2b4c4434832c3c
|
|
| MD5 |
65df7c5783787b8fb5b3cfacd81b4b78
|
|
| BLAKE2b-256 |
d49b4c06666fc89d4444f90d9f21268431876eaf80ac47c425d2a5e774296ef3
|
Provenance
The following attestation bundles were made for docx_md_comments-1.0.0.tar.gz:
Publisher:
publish.yml on Pascal-Kueng/docx-md-comments
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docx_md_comments-1.0.0.tar.gz -
Subject digest:
9d2902ce87faa2a535a67f05673866d6cad4b5dc30524bdc0d2b4c4434832c3c - Sigstore transparency entry: 950847358
- Sigstore integration time:
-
Permalink:
Pascal-Kueng/docx-md-comments@3464c235d6abb0ae2b07196be2f3eab71b59fcda -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Pascal-Kueng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3464c235d6abb0ae2b07196be2f3eab71b59fcda -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file docx_md_comments-1.0.0-py3-none-any.whl.
File metadata
- Download URL: docx_md_comments-1.0.0-py3-none-any.whl
- Upload date:
- Size: 40.1 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 |
062d83eca9793f2ef96adac62f540cd6a87a77350b400c317635395c1f8cf24c
|
|
| MD5 |
fc36f2f74889acca38d8e39615e81996
|
|
| BLAKE2b-256 |
21918c7243c598f667586228c225a57b38998bf8fd05ea3691380db3bc1bae09
|
Provenance
The following attestation bundles were made for docx_md_comments-1.0.0-py3-none-any.whl:
Publisher:
publish.yml on Pascal-Kueng/docx-md-comments
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
docx_md_comments-1.0.0-py3-none-any.whl -
Subject digest:
062d83eca9793f2ef96adac62f540cd6a87a77350b400c317635395c1f8cf24c - Sigstore transparency entry: 950847413
- Sigstore integration time:
-
Permalink:
Pascal-Kueng/docx-md-comments@3464c235d6abb0ae2b07196be2f3eab71b59fcda -
Branch / Tag:
refs/heads/main - Owner: https://github.com/Pascal-Kueng
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@3464c235d6abb0ae2b07196be2f3eab71b59fcda -
Trigger Event:
workflow_dispatch
-
Statement type: