mddocx-native 1.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- mddocx_native-1.2.1/LICENSE +21 -0
- mddocx_native-1.2.1/PKG-INFO +246 -0
- mddocx_native-1.2.1/README.md +197 -0
- mddocx_native-1.2.1/pyproject.toml +66 -0
- mddocx_native-1.2.1/setup.cfg +4 -0
- mddocx_native-1.2.1/src/mddocx/__init__.py +115 -0
- mddocx_native-1.2.1/src/mddocx/accessibility.py +198 -0
- mddocx_native-1.2.1/src/mddocx/api.py +352 -0
- mddocx_native-1.2.1/src/mddocx/api_stability.py +46 -0
- mddocx_native-1.2.1/src/mddocx/ast/__init__.py +5 -0
- mddocx_native-1.2.1/src/mddocx/ast/base.py +23 -0
- mddocx_native-1.2.1/src/mddocx/ast/block.py +166 -0
- mddocx_native-1.2.1/src/mddocx/ast/codec.py +83 -0
- mddocx_native-1.2.1/src/mddocx/ast/inline.py +82 -0
- mddocx_native-1.2.1/src/mddocx/attributes.py +80 -0
- mddocx_native-1.2.1/src/mddocx/batch.py +62 -0
- mddocx_native-1.2.1/src/mddocx/benchmark.py +116 -0
- mddocx_native-1.2.1/src/mddocx/bibliography.py +130 -0
- mddocx_native-1.2.1/src/mddocx/cache.py +46 -0
- mddocx_native-1.2.1/src/mddocx/cli.py +652 -0
- mddocx_native-1.2.1/src/mddocx/config.py +362 -0
- mddocx_native-1.2.1/src/mddocx/data.py +98 -0
- mddocx_native-1.2.1/src/mddocx/diagnostics/__init__.py +4 -0
- mddocx_native-1.2.1/src/mddocx/diagnostics/codes.py +32 -0
- mddocx_native-1.2.1/src/mddocx/diagnostics/reporter.py +77 -0
- mddocx_native-1.2.1/src/mddocx/diagrams/__init__.py +3 -0
- mddocx_native-1.2.1/src/mddocx/diagrams/mermaid.py +543 -0
- mddocx_native-1.2.1/src/mddocx/doctor.py +118 -0
- mddocx_native-1.2.1/src/mddocx/extensions/__init__.py +4 -0
- mddocx_native-1.2.1/src/mddocx/extensions/base.py +81 -0
- mddocx_native-1.2.1/src/mddocx/extensions/discovery.py +38 -0
- mddocx_native-1.2.1/src/mddocx/inspection.py +445 -0
- mddocx_native-1.2.1/src/mddocx/interactive/__init__.py +4 -0
- mddocx_native-1.2.1/src/mddocx/interactive/fonts.py +57 -0
- mddocx_native-1.2.1/src/mddocx/interactive/history.py +98 -0
- mddocx_native-1.2.1/src/mddocx/interactive/opening.py +17 -0
- mddocx_native-1.2.1/src/mddocx/interactive/shell.py +921 -0
- mddocx_native-1.2.1/src/mddocx/interactive/tokenize.py +14 -0
- mddocx_native-1.2.1/src/mddocx/interactive/workspace.py +67 -0
- mddocx_native-1.2.1/src/mddocx/limits.py +65 -0
- mddocx_native-1.2.1/src/mddocx/math/__init__.py +3 -0
- mddocx_native-1.2.1/src/mddocx/math/converter.py +47 -0
- mddocx_native-1.2.1/src/mddocx/math/latex.py +383 -0
- mddocx_native-1.2.1/src/mddocx/math/mathml.py +459 -0
- mddocx_native-1.2.1/src/mddocx/metadata.py +524 -0
- mddocx_native-1.2.1/src/mddocx/normalize/__init__.py +3 -0
- mddocx_native-1.2.1/src/mddocx/normalize/normalizer.py +9 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/__init__.py +3 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/charts.py +489 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/comments.py +109 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/endnotes.py +191 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/fields.py +243 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/footnotes.py +191 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/numbering.py +154 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/tasks.py +71 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/text.py +81 -0
- mddocx_native-1.2.1/src/mddocx/ooxml/utils.py +50 -0
- mddocx_native-1.2.1/src/mddocx/parser/__init__.py +4 -0
- mddocx_native-1.2.1/src/mddocx/parser/compatibility.py +446 -0
- mddocx_native-1.2.1/src/mddocx/parser/frontmatter.py +70 -0
- mddocx_native-1.2.1/src/mddocx/parser/markdown.py +519 -0
- mddocx_native-1.2.1/src/mddocx/profiling.py +22 -0
- mddocx_native-1.2.1/src/mddocx/project.py +739 -0
- mddocx_native-1.2.1/src/mddocx/references.py +106 -0
- mddocx_native-1.2.1/src/mddocx/render/__init__.py +3 -0
- mddocx_native-1.2.1/src/mddocx/render/renderer.py +1171 -0
- mddocx_native-1.2.1/src/mddocx/reproducibility.py +28 -0
- mddocx_native-1.2.1/src/mddocx/resources/__init__.py +3 -0
- mddocx_native-1.2.1/src/mddocx/resources/resolver.py +216 -0
- mddocx_native-1.2.1/src/mddocx/styles/__init__.py +4 -0
- mddocx_native-1.2.1/src/mddocx/styles/default.py +190 -0
- mddocx_native-1.2.1/src/mddocx/styles/themes.py +49 -0
- mddocx_native-1.2.1/src/mddocx/template_inspection.py +84 -0
- mddocx_native-1.2.1/src/mddocx/validation.py +83 -0
- mddocx_native-1.2.1/src/mddocx/visual_qa.py +178 -0
- mddocx_native-1.2.1/src/mddocx_native.egg-info/PKG-INFO +246 -0
- mddocx_native-1.2.1/src/mddocx_native.egg-info/SOURCES.txt +79 -0
- mddocx_native-1.2.1/src/mddocx_native.egg-info/dependency_links.txt +1 -0
- mddocx_native-1.2.1/src/mddocx_native.egg-info/entry_points.txt +2 -0
- mddocx_native-1.2.1/src/mddocx_native.egg-info/requires.txt +26 -0
- mddocx_native-1.2.1/src/mddocx_native.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tasin Ahmed
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: mddocx-native
|
|
3
|
+
Version: 1.2.1
|
|
4
|
+
Summary: Deterministic Markdown to native, editable Microsoft Word DOCX compiler
|
|
5
|
+
Author: Tasin Ahmed
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/TasinAhmed2508/mddocx
|
|
8
|
+
Project-URL: Repository, https://github.com/TasinAhmed2508/mddocx
|
|
9
|
+
Project-URL: Issues, https://github.com/TasinAhmed2508/mddocx/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/TasinAhmed2508/mddocx/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: markdown,docx,microsoft-word,document-conversion,ooxml
|
|
12
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Documentation
|
|
21
|
+
Classifier: Topic :: Office/Business
|
|
22
|
+
Classifier: Topic :: Text Processing :: Markup
|
|
23
|
+
Requires-Python: >=3.11
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: markdown-it-py>=3.0
|
|
27
|
+
Requires-Dist: python-docx>=1.1
|
|
28
|
+
Requires-Dist: lxml>=5.0
|
|
29
|
+
Requires-Dist: Pillow>=10.0
|
|
30
|
+
Requires-Dist: Pygments>=2.17
|
|
31
|
+
Requires-Dist: PyYAML>=6.0
|
|
32
|
+
Requires-Dist: openpyxl>=3.1
|
|
33
|
+
Requires-Dist: prompt-toolkit>=3.0
|
|
34
|
+
Provides-Extra: math
|
|
35
|
+
Requires-Dist: latex2mathml>=3.81.0; extra == "math"
|
|
36
|
+
Provides-Extra: frontmatter
|
|
37
|
+
Requires-Dist: PyYAML>=6.0; extra == "frontmatter"
|
|
38
|
+
Provides-Extra: images
|
|
39
|
+
Requires-Dist: Pillow>=10.0; extra == "images"
|
|
40
|
+
Requires-Dist: CairoSVG>=2.7; extra == "images"
|
|
41
|
+
Requires-Dist: defusedxml>=0.7; extra == "images"
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
44
|
+
Requires-Dist: ruff>=0.6; extra == "dev"
|
|
45
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
46
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
47
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
48
|
+
Dynamic: license-file
|
|
49
|
+
|
|
50
|
+
# mddocx
|
|
51
|
+
|
|
52
|
+
[](https://pypi.org/project/mddocx-native/)
|
|
53
|
+
[](https://pypi.org/project/mddocx-native/)
|
|
54
|
+
[](https://github.com/TasinAhmed2508/mddocx/actions/workflows/ci.yml)
|
|
55
|
+
[](https://github.com/TasinAhmed2508/mddocx/releases/latest)
|
|
56
|
+
[](LICENSE)
|
|
57
|
+
|
|
58
|
+
Deterministic Markdown-to-DOCX compilation for professional, editable Microsoft Word documents.
|
|
59
|
+
|
|
60
|
+
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.
|
|
61
|
+
|
|
62
|
+
## What it does
|
|
63
|
+
|
|
64
|
+
- Converts Markdown files or strings into native DOCX documents.
|
|
65
|
+
- Preserves editable Word headings, paragraphs, lists, tables, hyperlinks, and code blocks.
|
|
66
|
+
- Supports nested lists, task lists, blockquotes, callouts, page breaks, and section breaks.
|
|
67
|
+
- Produces editable Word equations using OMML rather than images.
|
|
68
|
+
- Creates editable Office charts backed by embedded Excel workbooks.
|
|
69
|
+
- Supports CSV and JSON data for charts and native Word tables.
|
|
70
|
+
- Handles images, captions, bookmarks, cross-references, footnotes, endnotes, and citations.
|
|
71
|
+
- Supports themes, fonts, templates, right-to-left text, headers, footers, tables of contents, and page fields.
|
|
72
|
+
- Provides project mode for compiling multiple Markdown chapters into one document.
|
|
73
|
+
- Includes diagnostics, document inspection, accessibility checks, and profiling utilities.
|
|
74
|
+
- Provides privacy-aware metadata handling for exported AI/chat conversations.
|
|
75
|
+
|
|
76
|
+
## Installation
|
|
77
|
+
|
|
78
|
+
mddocx requires Python 3.11 or newer.
|
|
79
|
+
|
|
80
|
+
### Install from PyPI
|
|
81
|
+
|
|
82
|
+
The distribution is published as `mddocx-native`; the Python import and command remain `mddocx`:
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
python -m pip install --upgrade mddocx-native
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
Verify the installation:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
mddocx --version
|
|
92
|
+
mddocx doctor
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### Install a downloaded wheel
|
|
96
|
+
|
|
97
|
+
Download the `.whl` file from the [latest GitHub Release](https://github.com/TasinAhmed2508/mddocx/releases/latest), open a terminal in the download directory, and run:
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
python -m pip install ./mddocx_native-1.2.1-py3-none-any.whl
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
On Windows PowerShell, the equivalent command is:
|
|
104
|
+
|
|
105
|
+
```powershell
|
|
106
|
+
python -m pip install .\mddocx_native-1.2.1-py3-none-any.whl
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
You can also install the wheel directly from the v1.2.1 GitHub Release:
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
python -m pip install "https://github.com/TasinAhmed2508/mddocx/releases/download/v1.2.1/mddocx_native-1.2.1-py3-none-any.whl"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Install from GitHub
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
python -m pip install "git+https://github.com/TasinAhmed2508/mddocx.git@v1.2.1"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
### Install for local development
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
git clone https://github.com/TasinAhmed2508/mddocx.git
|
|
125
|
+
cd mddocx
|
|
126
|
+
python -m pip install -e ".[dev]"
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
Optional features:
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
python -m pip install "mddocx-native[math]"
|
|
133
|
+
python -m pip install "mddocx-native[images]"
|
|
134
|
+
python -m pip install "mddocx-native[math,images]"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
## Quick start
|
|
138
|
+
|
|
139
|
+
Create a file named report.md:
|
|
140
|
+
|
|
141
|
+
# Quarterly Report
|
|
142
|
+
|
|
143
|
+
## Summary
|
|
144
|
+
|
|
145
|
+
This report is generated from Markdown and remains fully editable in Word.
|
|
146
|
+
|
|
147
|
+
| Metric | Value |
|
|
148
|
+
| --- | ---: |
|
|
149
|
+
| Revenue | 125,000 |
|
|
150
|
+
| Growth | 18% |
|
|
151
|
+
|
|
152
|
+
Convert it to Word:
|
|
153
|
+
|
|
154
|
+
mddocx report.md -o report.docx
|
|
155
|
+
|
|
156
|
+
## Command-line interface
|
|
157
|
+
|
|
158
|
+
mddocx document.md -o document.docx
|
|
159
|
+
mddocx document.md --theme academic
|
|
160
|
+
mddocx document.md --template company.docx
|
|
161
|
+
mddocx document.md --toc --page-numbers
|
|
162
|
+
mddocx document.md --header "Project Report" --footer "Confidential"
|
|
163
|
+
mddocx document.md --diagnostics-json diagnostics.json
|
|
164
|
+
mddocx inspect document.docx --strict
|
|
165
|
+
mddocx accessibility document.docx --strict
|
|
166
|
+
mddocx doctor
|
|
167
|
+
mddocx api --json
|
|
168
|
+
|
|
169
|
+
For multi-file document projects:
|
|
170
|
+
|
|
171
|
+
mddocx project init report
|
|
172
|
+
mddocx build report
|
|
173
|
+
mddocx project info report
|
|
174
|
+
mddocx watch report
|
|
175
|
+
|
|
176
|
+
For interactive use:
|
|
177
|
+
|
|
178
|
+
mddocx shell
|
|
179
|
+
|
|
180
|
+
Run mddocx --help for the complete command reference.
|
|
181
|
+
|
|
182
|
+
## Python API
|
|
183
|
+
|
|
184
|
+
from mddocx import RenderConfig, render, render_string
|
|
185
|
+
|
|
186
|
+
render("report.md", "report.docx")
|
|
187
|
+
|
|
188
|
+
config = RenderConfig(theme="modern")
|
|
189
|
+
document = render_string("# Generated report\n\nEditable Word content.", config=config)
|
|
190
|
+
|
|
191
|
+
with open("generated.docx", "wb") as file:
|
|
192
|
+
file.write(document)
|
|
193
|
+
|
|
194
|
+
The public API is documented in docs/API_STABILITY.md and can also be inspected with mddocx api --json.
|
|
195
|
+
|
|
196
|
+
## YAML front matter
|
|
197
|
+
|
|
198
|
+
Document settings can be defined at the top of a Markdown file:
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
title: Research Report
|
|
202
|
+
author: Example Author
|
|
203
|
+
theme: academic
|
|
204
|
+
toc: true
|
|
205
|
+
page_numbers: true
|
|
206
|
+
auto_landscape_tables: true
|
|
207
|
+
header: Research Group
|
|
208
|
+
footer: Confidential
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Privacy and security defaults
|
|
212
|
+
|
|
213
|
+
- Remote resources are disabled by default.
|
|
214
|
+
- HTTPS image downloads can be explicitly enabled and restricted by domain.
|
|
215
|
+
- Local resource paths cannot escape the document or project directory.
|
|
216
|
+
- Download size, MIME type, redirects, and network destinations are constrained.
|
|
217
|
+
- SVG parsing rejects external references and uses hardened XML handling.
|
|
218
|
+
- Code blocks and TeX are never executed.
|
|
219
|
+
- AI/chat export metadata is removed conservatively before Markdown parsing when enabled.
|
|
220
|
+
|
|
221
|
+
## Project layout
|
|
222
|
+
|
|
223
|
+
mddocx/
|
|
224
|
+
├── src/mddocx/ # Package source code
|
|
225
|
+
├── docs/ # User and technical documentation
|
|
226
|
+
├── dist/ # Local build output, when generated
|
|
227
|
+
├── .github/workflows/ # CI and release automation
|
|
228
|
+
├── pyproject.toml # Package metadata and build configuration
|
|
229
|
+
└── README.md # Project overview and usage guide
|
|
230
|
+
|
|
231
|
+
## Documentation
|
|
232
|
+
|
|
233
|
+
Detailed documentation is available in the docs directory, including compatibility, API stability, interactive CLI, charts and data, AI export metadata, accessibility, and extensions.
|
|
234
|
+
|
|
235
|
+
## Releases
|
|
236
|
+
|
|
237
|
+
Release builds are generated by GitHub Actions. Each versioned release publishes the wheel and source archive as downloadable GitHub Release assets.
|
|
238
|
+
|
|
239
|
+
- [Latest release](https://github.com/TasinAhmed2508/mddocx/releases/latest)
|
|
240
|
+
- [All releases](https://github.com/TasinAhmed2508/mddocx/releases)
|
|
241
|
+
- [All version tags](https://github.com/TasinAhmed2508/mddocx/tags)
|
|
242
|
+
- [PyPI package](https://pypi.org/project/mddocx-native/)
|
|
243
|
+
|
|
244
|
+
## License
|
|
245
|
+
|
|
246
|
+
Released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# mddocx
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/mddocx-native/)
|
|
4
|
+
[](https://pypi.org/project/mddocx-native/)
|
|
5
|
+
[](https://github.com/TasinAhmed2508/mddocx/actions/workflows/ci.yml)
|
|
6
|
+
[](https://github.com/TasinAhmed2508/mddocx/releases/latest)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
Deterministic Markdown-to-DOCX compilation for professional, editable Microsoft Word documents.
|
|
10
|
+
|
|
11
|
+
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.
|
|
12
|
+
|
|
13
|
+
## What it does
|
|
14
|
+
|
|
15
|
+
- Converts Markdown files or strings into native DOCX documents.
|
|
16
|
+
- Preserves editable Word headings, paragraphs, lists, tables, hyperlinks, and code blocks.
|
|
17
|
+
- Supports nested lists, task lists, blockquotes, callouts, page breaks, and section breaks.
|
|
18
|
+
- Produces editable Word equations using OMML rather than images.
|
|
19
|
+
- Creates editable Office charts backed by embedded Excel workbooks.
|
|
20
|
+
- Supports CSV and JSON data for charts and native Word tables.
|
|
21
|
+
- Handles images, captions, bookmarks, cross-references, footnotes, endnotes, and citations.
|
|
22
|
+
- Supports themes, fonts, templates, right-to-left text, headers, footers, tables of contents, and page fields.
|
|
23
|
+
- Provides project mode for compiling multiple Markdown chapters into one document.
|
|
24
|
+
- Includes diagnostics, document inspection, accessibility checks, and profiling utilities.
|
|
25
|
+
- Provides privacy-aware metadata handling for exported AI/chat conversations.
|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
mddocx requires Python 3.11 or newer.
|
|
30
|
+
|
|
31
|
+
### Install from PyPI
|
|
32
|
+
|
|
33
|
+
The distribution is published as `mddocx-native`; the Python import and command remain `mddocx`:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
python -m pip install --upgrade mddocx-native
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Verify the installation:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
mddocx --version
|
|
43
|
+
mddocx doctor
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### Install a downloaded wheel
|
|
47
|
+
|
|
48
|
+
Download the `.whl` file from the [latest GitHub Release](https://github.com/TasinAhmed2508/mddocx/releases/latest), open a terminal in the download directory, and run:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
python -m pip install ./mddocx_native-1.2.1-py3-none-any.whl
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
On Windows PowerShell, the equivalent command is:
|
|
55
|
+
|
|
56
|
+
```powershell
|
|
57
|
+
python -m pip install .\mddocx_native-1.2.1-py3-none-any.whl
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
You can also install the wheel directly from the v1.2.1 GitHub Release:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
python -m pip install "https://github.com/TasinAhmed2508/mddocx/releases/download/v1.2.1/mddocx_native-1.2.1-py3-none-any.whl"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Install from GitHub
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
python -m pip install "git+https://github.com/TasinAhmed2508/mddocx.git@v1.2.1"
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### Install for local development
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
git clone https://github.com/TasinAhmed2508/mddocx.git
|
|
76
|
+
cd mddocx
|
|
77
|
+
python -m pip install -e ".[dev]"
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Optional features:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
python -m pip install "mddocx-native[math]"
|
|
84
|
+
python -m pip install "mddocx-native[images]"
|
|
85
|
+
python -m pip install "mddocx-native[math,images]"
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Quick start
|
|
89
|
+
|
|
90
|
+
Create a file named report.md:
|
|
91
|
+
|
|
92
|
+
# Quarterly Report
|
|
93
|
+
|
|
94
|
+
## Summary
|
|
95
|
+
|
|
96
|
+
This report is generated from Markdown and remains fully editable in Word.
|
|
97
|
+
|
|
98
|
+
| Metric | Value |
|
|
99
|
+
| --- | ---: |
|
|
100
|
+
| Revenue | 125,000 |
|
|
101
|
+
| Growth | 18% |
|
|
102
|
+
|
|
103
|
+
Convert it to Word:
|
|
104
|
+
|
|
105
|
+
mddocx report.md -o report.docx
|
|
106
|
+
|
|
107
|
+
## Command-line interface
|
|
108
|
+
|
|
109
|
+
mddocx document.md -o document.docx
|
|
110
|
+
mddocx document.md --theme academic
|
|
111
|
+
mddocx document.md --template company.docx
|
|
112
|
+
mddocx document.md --toc --page-numbers
|
|
113
|
+
mddocx document.md --header "Project Report" --footer "Confidential"
|
|
114
|
+
mddocx document.md --diagnostics-json diagnostics.json
|
|
115
|
+
mddocx inspect document.docx --strict
|
|
116
|
+
mddocx accessibility document.docx --strict
|
|
117
|
+
mddocx doctor
|
|
118
|
+
mddocx api --json
|
|
119
|
+
|
|
120
|
+
For multi-file document projects:
|
|
121
|
+
|
|
122
|
+
mddocx project init report
|
|
123
|
+
mddocx build report
|
|
124
|
+
mddocx project info report
|
|
125
|
+
mddocx watch report
|
|
126
|
+
|
|
127
|
+
For interactive use:
|
|
128
|
+
|
|
129
|
+
mddocx shell
|
|
130
|
+
|
|
131
|
+
Run mddocx --help for the complete command reference.
|
|
132
|
+
|
|
133
|
+
## Python API
|
|
134
|
+
|
|
135
|
+
from mddocx import RenderConfig, render, render_string
|
|
136
|
+
|
|
137
|
+
render("report.md", "report.docx")
|
|
138
|
+
|
|
139
|
+
config = RenderConfig(theme="modern")
|
|
140
|
+
document = render_string("# Generated report\n\nEditable Word content.", config=config)
|
|
141
|
+
|
|
142
|
+
with open("generated.docx", "wb") as file:
|
|
143
|
+
file.write(document)
|
|
144
|
+
|
|
145
|
+
The public API is documented in docs/API_STABILITY.md and can also be inspected with mddocx api --json.
|
|
146
|
+
|
|
147
|
+
## YAML front matter
|
|
148
|
+
|
|
149
|
+
Document settings can be defined at the top of a Markdown file:
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
title: Research Report
|
|
153
|
+
author: Example Author
|
|
154
|
+
theme: academic
|
|
155
|
+
toc: true
|
|
156
|
+
page_numbers: true
|
|
157
|
+
auto_landscape_tables: true
|
|
158
|
+
header: Research Group
|
|
159
|
+
footer: Confidential
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Privacy and security defaults
|
|
163
|
+
|
|
164
|
+
- Remote resources are disabled by default.
|
|
165
|
+
- HTTPS image downloads can be explicitly enabled and restricted by domain.
|
|
166
|
+
- Local resource paths cannot escape the document or project directory.
|
|
167
|
+
- Download size, MIME type, redirects, and network destinations are constrained.
|
|
168
|
+
- SVG parsing rejects external references and uses hardened XML handling.
|
|
169
|
+
- Code blocks and TeX are never executed.
|
|
170
|
+
- AI/chat export metadata is removed conservatively before Markdown parsing when enabled.
|
|
171
|
+
|
|
172
|
+
## Project layout
|
|
173
|
+
|
|
174
|
+
mddocx/
|
|
175
|
+
├── src/mddocx/ # Package source code
|
|
176
|
+
├── docs/ # User and technical documentation
|
|
177
|
+
├── dist/ # Local build output, when generated
|
|
178
|
+
├── .github/workflows/ # CI and release automation
|
|
179
|
+
├── pyproject.toml # Package metadata and build configuration
|
|
180
|
+
└── README.md # Project overview and usage guide
|
|
181
|
+
|
|
182
|
+
## Documentation
|
|
183
|
+
|
|
184
|
+
Detailed documentation is available in the docs directory, including compatibility, API stability, interactive CLI, charts and data, AI export metadata, accessibility, and extensions.
|
|
185
|
+
|
|
186
|
+
## Releases
|
|
187
|
+
|
|
188
|
+
Release builds are generated by GitHub Actions. Each versioned release publishes the wheel and source archive as downloadable GitHub Release assets.
|
|
189
|
+
|
|
190
|
+
- [Latest release](https://github.com/TasinAhmed2508/mddocx/releases/latest)
|
|
191
|
+
- [All releases](https://github.com/TasinAhmed2508/mddocx/releases)
|
|
192
|
+
- [All version tags](https://github.com/TasinAhmed2508/mddocx/tags)
|
|
193
|
+
- [PyPI package](https://pypi.org/project/mddocx-native/)
|
|
194
|
+
|
|
195
|
+
## License
|
|
196
|
+
|
|
197
|
+
Released under the [MIT License](LICENSE).
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "mddocx-native"
|
|
7
|
+
version = "1.2.1"
|
|
8
|
+
description = "Deterministic Markdown to native, editable Microsoft Word DOCX compiler"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.11"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Tasin Ahmed" },
|
|
15
|
+
]
|
|
16
|
+
keywords = ["markdown", "docx", "microsoft-word", "document-conversion", "ooxml"]
|
|
17
|
+
classifiers = [
|
|
18
|
+
"Development Status :: 5 - Production/Stable",
|
|
19
|
+
"Environment :: Console",
|
|
20
|
+
"Intended Audience :: Developers",
|
|
21
|
+
"Operating System :: OS Independent",
|
|
22
|
+
"Programming Language :: Python :: 3",
|
|
23
|
+
"Programming Language :: Python :: 3.11",
|
|
24
|
+
"Programming Language :: Python :: 3.12",
|
|
25
|
+
"Programming Language :: Python :: 3.13",
|
|
26
|
+
"Topic :: Documentation",
|
|
27
|
+
"Topic :: Office/Business",
|
|
28
|
+
"Topic :: Text Processing :: Markup",
|
|
29
|
+
]
|
|
30
|
+
dependencies = [
|
|
31
|
+
"markdown-it-py>=3.0",
|
|
32
|
+
"python-docx>=1.1",
|
|
33
|
+
"lxml>=5.0",
|
|
34
|
+
"Pillow>=10.0",
|
|
35
|
+
"Pygments>=2.17",
|
|
36
|
+
"PyYAML>=6.0",
|
|
37
|
+
"openpyxl>=3.1",
|
|
38
|
+
"prompt-toolkit>=3.0",
|
|
39
|
+
]
|
|
40
|
+
|
|
41
|
+
[project.urls]
|
|
42
|
+
Homepage = "https://github.com/TasinAhmed2508/mddocx"
|
|
43
|
+
Repository = "https://github.com/TasinAhmed2508/mddocx"
|
|
44
|
+
Issues = "https://github.com/TasinAhmed2508/mddocx/issues"
|
|
45
|
+
Changelog = "https://github.com/TasinAhmed2508/mddocx/blob/main/CHANGELOG.md"
|
|
46
|
+
|
|
47
|
+
[project.optional-dependencies]
|
|
48
|
+
math = ["latex2mathml>=3.81.0"]
|
|
49
|
+
frontmatter = ["PyYAML>=6.0"]
|
|
50
|
+
images = ["Pillow>=10.0", "CairoSVG>=2.7", "defusedxml>=0.7"]
|
|
51
|
+
dev = ["pytest>=8", "ruff>=0.6", "mypy>=1.10", "build>=1.2", "twine>=5.0"]
|
|
52
|
+
|
|
53
|
+
[project.scripts]
|
|
54
|
+
mddocx = "mddocx.cli:main"
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.packages.find]
|
|
57
|
+
where = ["src"]
|
|
58
|
+
|
|
59
|
+
[tool.pytest.ini_options]
|
|
60
|
+
testpaths = ["tests"]
|
|
61
|
+
addopts = "-q"
|
|
62
|
+
markers = ["visual: LibreOffice page-render regression tests"]
|
|
63
|
+
|
|
64
|
+
[tool.ruff]
|
|
65
|
+
line-length = 100
|
|
66
|
+
target-version = "py311"
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
from .api import MarkdownWord, render, render_string
|
|
2
|
+
from .batch import BatchResult, collect_markdown_inputs, render_many
|
|
3
|
+
from .config import (
|
|
4
|
+
CacheConfig,
|
|
5
|
+
CompilationLimits,
|
|
6
|
+
FontConfig,
|
|
7
|
+
FooterConfig,
|
|
8
|
+
HeaderConfig,
|
|
9
|
+
ImageConfig,
|
|
10
|
+
Margins,
|
|
11
|
+
ListConfig,
|
|
12
|
+
MathFailurePolicy,
|
|
13
|
+
MermaidConfig,
|
|
14
|
+
ChartConfig,
|
|
15
|
+
DataConfig,
|
|
16
|
+
PageConfig,
|
|
17
|
+
PerformanceConfig,
|
|
18
|
+
PluginConfig,
|
|
19
|
+
RenderConfig,
|
|
20
|
+
ReproducibilityConfig,
|
|
21
|
+
ResourcePolicy,
|
|
22
|
+
TableConfig,
|
|
23
|
+
TOCConfig,
|
|
24
|
+
ValidationConfig,
|
|
25
|
+
ReferenceConfig, NotesConfig, CitationConfig, AccessibilityConfig, FigureConfig,
|
|
26
|
+
HeadingNumberingConfig, TitlePageConfig, AbstractConfig, CodeConfig, CalloutConfig, CommentConfig, FieldConfig, MetadataConfig,
|
|
27
|
+
)
|
|
28
|
+
from .extensions import MddocxExtension, load_entrypoint_extensions
|
|
29
|
+
from .profiling import RenderStats
|
|
30
|
+
from .validation import validate_docx_package
|
|
31
|
+
from .inspection import DocxInspection, inspect_docx, inspect_docx_bytes
|
|
32
|
+
from .visual_qa import VisualQAReport, compare_visual_pages, render_docx_pages
|
|
33
|
+
from .accessibility import AccessibilityFinding, AccessibilityReport, audit_docx_accessibility, audit_docx_accessibility_bytes
|
|
34
|
+
from .benchmark import BenchmarkReport, run_performance_gate
|
|
35
|
+
from .api_stability import PUBLIC_API_VERSION, get_public_api_manifest
|
|
36
|
+
from .metadata import MetadataSanitizationReport, SanitizedMarkdown, sanitize_markdown_metadata
|
|
37
|
+
from .project import (
|
|
38
|
+
ProjectManifest, ProjectCompilation, ProjectBuildResult, ProjectWatchEvent,
|
|
39
|
+
load_project, compile_project, build_project, watch_project, init_project, project_info,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
__all__ = [
|
|
43
|
+
"MarkdownWord",
|
|
44
|
+
"RenderConfig",
|
|
45
|
+
"Margins",
|
|
46
|
+
"ListConfig",
|
|
47
|
+
"PageConfig",
|
|
48
|
+
"ResourcePolicy",
|
|
49
|
+
"MathFailurePolicy",
|
|
50
|
+
"MermaidConfig",
|
|
51
|
+
"ChartConfig",
|
|
52
|
+
"DataConfig",
|
|
53
|
+
"HeaderConfig",
|
|
54
|
+
"FooterConfig",
|
|
55
|
+
"TOCConfig",
|
|
56
|
+
"TableConfig",
|
|
57
|
+
"FontConfig",
|
|
58
|
+
"ImageConfig",
|
|
59
|
+
"PerformanceConfig",
|
|
60
|
+
"CompilationLimits",
|
|
61
|
+
"ReproducibilityConfig",
|
|
62
|
+
"ValidationConfig",
|
|
63
|
+
"CacheConfig",
|
|
64
|
+
"PluginConfig",
|
|
65
|
+
"ReferenceConfig",
|
|
66
|
+
"NotesConfig",
|
|
67
|
+
"CitationConfig",
|
|
68
|
+
"AccessibilityConfig",
|
|
69
|
+
"FigureConfig",
|
|
70
|
+
"HeadingNumberingConfig",
|
|
71
|
+
"TitlePageConfig",
|
|
72
|
+
"AbstractConfig",
|
|
73
|
+
"CodeConfig",
|
|
74
|
+
"CalloutConfig",
|
|
75
|
+
"CommentConfig",
|
|
76
|
+
"FieldConfig",
|
|
77
|
+
"MetadataConfig",
|
|
78
|
+
"MetadataSanitizationReport",
|
|
79
|
+
"SanitizedMarkdown",
|
|
80
|
+
"sanitize_markdown_metadata",
|
|
81
|
+
"RenderStats",
|
|
82
|
+
"MddocxExtension",
|
|
83
|
+
"load_entrypoint_extensions",
|
|
84
|
+
"BatchResult",
|
|
85
|
+
"collect_markdown_inputs",
|
|
86
|
+
"render_many",
|
|
87
|
+
"validate_docx_package",
|
|
88
|
+
"DocxInspection",
|
|
89
|
+
"inspect_docx",
|
|
90
|
+
"inspect_docx_bytes",
|
|
91
|
+
"VisualQAReport",
|
|
92
|
+
"compare_visual_pages",
|
|
93
|
+
"render_docx_pages",
|
|
94
|
+
"render",
|
|
95
|
+
"render_string",
|
|
96
|
+
"ProjectManifest",
|
|
97
|
+
"ProjectCompilation",
|
|
98
|
+
"ProjectBuildResult",
|
|
99
|
+
"ProjectWatchEvent",
|
|
100
|
+
"load_project",
|
|
101
|
+
"compile_project",
|
|
102
|
+
"build_project",
|
|
103
|
+
"watch_project",
|
|
104
|
+
"init_project",
|
|
105
|
+
"project_info",
|
|
106
|
+
"AccessibilityFinding",
|
|
107
|
+
"AccessibilityReport",
|
|
108
|
+
"audit_docx_accessibility",
|
|
109
|
+
"audit_docx_accessibility_bytes",
|
|
110
|
+
"BenchmarkReport",
|
|
111
|
+
"run_performance_gate",
|
|
112
|
+
"PUBLIC_API_VERSION",
|
|
113
|
+
"get_public_api_manifest",
|
|
114
|
+
]
|
|
115
|
+
__version__ = "1.2.1"
|