markdown-docx 0.2.0__tar.gz → 0.3.0__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.
Files changed (64) hide show
  1. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/AGENTS.md +2 -2
  2. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/CHANGELOG.md +8 -0
  3. markdown_docx-0.3.0/PKG-INFO +489 -0
  4. markdown_docx-0.3.0/README.md +457 -0
  5. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/docs/public-api-capabilities.md +8 -4
  6. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/docs/skill-management.md +1 -1
  7. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/pyproject.toml +1 -1
  8. markdown_docx-0.3.0/sample/assets/showcase-page-1.png +0 -0
  9. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/showcase.docx +0 -0
  10. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/showcase.md +2 -1
  11. markdown_docx-0.3.0/src/markdown_docx/__init__.py +1 -0
  12. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/assets/syntax.json +2 -2
  13. markdown_docx-0.3.0/src/markdown_docx/hyperlinks.py +43 -0
  14. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/markdown_body.py +26 -14
  15. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/models.py +3 -1
  16. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/parser.py +2 -2
  17. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/renderer.py +12 -3
  18. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/skill.py +1 -1
  19. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_cli.py +1 -1
  20. markdown_docx-0.3.0/tests/test_hyperlinks.py +161 -0
  21. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_parser.py +2 -1
  22. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_public_api_boundary.py +4 -2
  23. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_showcase.py +4 -0
  24. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/uv.lock +1 -1
  25. markdown_docx-0.2.0/PKG-INFO +0 -406
  26. markdown_docx-0.2.0/README.md +0 -374
  27. markdown_docx-0.2.0/src/markdown_docx/__init__.py +0 -1
  28. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/.github/workflows/ci.yml +0 -0
  29. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/.github/workflows/publish-pypi.yml +0 -0
  30. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/.gitignore +0 -0
  31. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/LICENSE +0 -0
  32. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/PLAN.md +0 -0
  33. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/dog-lunch-chase.png +0 -0
  34. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/dog-run-finish.png +0 -0
  35. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/dog-run-start.png +0 -0
  36. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/dog-trio-cameo.png +0 -0
  37. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/dog-trio-inline.png +0 -0
  38. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/dog-wagon-rescue.png +0 -0
  39. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/illustration-prompts.md +0 -0
  40. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/word-icon.png +0 -0
  41. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/sample/assets/word-workflow.png +0 -0
  42. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/scripts/Export-DocxPdf.ps1 +0 -0
  43. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/scripts/build_default_template.py +0 -0
  44. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/scripts/build_qa_templates.py +0 -0
  45. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/scripts/build_showcase_assets.py +0 -0
  46. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/scripts/smoke_skill.py +0 -0
  47. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/assets/default.docx +0 -0
  48. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/assets.py +0 -0
  49. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/cli.py +0 -0
  50. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/errors.py +0 -0
  51. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/images.py +0 -0
  52. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/metadata.py +0 -0
  53. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/styles.py +0 -0
  54. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/src/markdown_docx/template.py +0 -0
  55. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/conftest.py +0 -0
  56. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_metadata.py +0 -0
  57. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_public_api_capabilities.py +0 -0
  58. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_renderer_images.py +0 -0
  59. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_renderer_lists.py +0 -0
  60. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_renderer_sections.py +0 -0
  61. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_renderer_tables.py +0 -0
  62. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_renderer_text.py +0 -0
  63. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_skill.py +0 -0
  64. {markdown_docx-0.2.0 → markdown_docx-0.3.0}/tests/test_template.py +0 -0
@@ -10,8 +10,8 @@ This repository contains `markdown-docx`, a strict Python CLI that converts cons
10
10
 
11
11
  ## Core rules
12
12
 
13
- - Use only supported public `python-docx` APIs in production code.
14
- - Never edit OOXML parts directly in production code.
13
+ - Use only supported public `python-docx` APIs in production code, except for the isolated hyperlink helper.
14
+ - Direct OOXML creation is allowed only in `src/markdown_docx/hyperlinks.py` to create native hyperlinks. Replace this helper when a supported public API becomes available.
15
15
  - Preserve normal Markdown meaning and keep Word metadata in invisible reserved HTML comments.
16
16
  - Reject unsupported behavior with stable, line-aware diagnostics.
17
17
  - Treat Word sections as layout boundaries. Headings never create sections.
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.3.0
4
+
5
+ - Convert Markdown links into native, clickable, editable Word hyperlinks in paragraphs, headings, blockquotes, lists, and table cells.
6
+ - Preserve formatted link labels, optional title tooltips, and linked inline images. Support reference links, angle-bracket autolinks, email links, and relative file destinations.
7
+ - Preserve template hyperlink styles and supply a theme-aware default when needed. Keep hyperlink OOXML creation isolated until python-docx provides a public authoring API.
8
+ - Update syntax discovery, managed skill guidance, documentation, and the showcase. Add hyperlink parsing, rendering, relationship, and CLI regression tests.
9
+ - Continue rejecting empty destinations and document-local bookmark links with line-aware diagnostics.
10
+
3
11
  ## 0.2.0
4
12
 
5
13
  - Synchronize existing pristine managed skills to the running CLI version during normal commands.
@@ -0,0 +1,489 @@
1
+ Metadata-Version: 2.5
2
+ Name: markdown-docx
3
+ Version: 0.3.0
4
+ Summary: Convert constrained Markdown documents into editable Word files.
5
+ Project-URL: Homepage, https://github.com/pseudosavant/markdown-docx
6
+ Project-URL: Repository, https://github.com/pseudosavant/markdown-docx
7
+ Project-URL: Issues, https://github.com/pseudosavant/markdown-docx/issues
8
+ Project-URL: Releases, https://github.com/pseudosavant/markdown-docx/releases
9
+ Author: John Paul Ellis
10
+ License-Expression: MIT
11
+ License-File: LICENSE
12
+ Keywords: cli,document,docx,markdown,word
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: License :: OSI Approved :: MIT License
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: Programming Language :: Python :: 3.14
21
+ Classifier: Topic :: Office/Business :: Office Suites
22
+ Classifier: Topic :: Software Development :: Documentation
23
+ Classifier: Topic :: Text Processing :: Markup
24
+ Requires-Python: >=3.11
25
+ Requires-Dist: httpx<1,>=0.27
26
+ Requires-Dist: markdown-it-py<5,>=3.0
27
+ Requires-Dist: packaging>=24.0
28
+ Requires-Dist: pillow<13,>=10.0
29
+ Requires-Dist: python-docx==1.2.0
30
+ Requires-Dist: pyyaml<7,>=6.0
31
+ Description-Content-Type: text/markdown
32
+
33
+ # markdown-docx
34
+
35
+ `markdown-docx` turns constrained Markdown into editable Word `.docx` documents built from real Word paragraphs, tables, images, styles, and sections. It is a strict, predictable CLI designed for both people and coding agents.
36
+
37
+ The Markdown stays readable in normal renderers. Word-specific layout and style settings live in invisible reserved HTML comments. Unsupported input produces a stable, line-aware error instead of an approximate document.
38
+
39
+ ## Prerequisite
40
+
41
+ `markdown-docx` is designed to be used with [`uv`](https://docs.astral.sh/uv/getting-started/installation/). Install `uv` before continuing. The documented workflows use `uvx` to run the tool without requiring a global installation.
42
+
43
+ ## Quick start with an agent
44
+
45
+ Install the managed agent skill:
46
+
47
+ ```powershell
48
+ uvx markdown-docx skill install
49
+ ```
50
+
51
+ Then use `$markdown-docx` in Codex, Claude Code, or another agent harness that supports skills:
52
+
53
+ > Use $markdown-docx to create a project brief. Keep the source readable as normal Markdown and save the editable DOCX beside it.
54
+
55
+ The skill teaches the agent how to inspect the format and templates, write valid document Markdown, render the document safely, and handle structured results.
56
+
57
+ ## What it creates
58
+
59
+ Markdown stays readable, while the generated document remains easy to edit in Word.
60
+
61
+ ![Rendered Word document example](sample/assets/showcase-page-1.png)
62
+
63
+ See the [showcase Markdown](sample/showcase.md) and its [editable Word output](sample/showcase.docx) for a complete example.
64
+
65
+ ## Use the CLI directly
66
+
67
+ Render a document without installing the package globally:
68
+
69
+ ```powershell
70
+ uvx markdown-docx document.md document.docx
71
+ ```
72
+
73
+ When the output path is omitted, the tool writes a `.docx` beside the input Markdown file:
74
+
75
+ ```powershell
76
+ uvx markdown-docx document.md
77
+ ```
78
+
79
+ Inspect the supported format or the styles in the default template:
80
+
81
+ ```powershell
82
+ uvx markdown-docx --syntax
83
+ uvx markdown-docx --list-styles
84
+ uvx markdown-docx --list-table-styles
85
+ ```
86
+
87
+ To install the command as a persistent tool instead:
88
+
89
+ ```powershell
90
+ uv tool install markdown-docx
91
+ ```
92
+
93
+ The examples below continue to use `uvx markdown-docx` so they work without a global installation.
94
+
95
+ ## How the format works
96
+
97
+ ![Readable Markdown converted into editable Word](sample/assets/word-workflow.png)
98
+
99
+ The document model has four core rules:
100
+
101
+ 1. Standard Markdown contains the document content.
102
+ 2. Optional document metadata may appear once at the beginning of the file.
103
+ 3. Table, image, page-break, and section directives appear immediately before the content they affect.
104
+ 4. Word templates own detailed formatting such as styles, spacing, colors, borders, and numbering.
105
+
106
+ Headings organize content. They never create Word sections.
107
+
108
+ A minimal document needs no Word metadata:
109
+
110
+ ```markdown
111
+ # Project brief
112
+
113
+ This document was generated from readable Markdown.
114
+
115
+ ## Goals
116
+
117
+ - Make the launch process repeatable
118
+ - Give every deliverable a clear owner
119
+ - Keep the final document editable
120
+
121
+ | Deliverable | Owner | Status |
122
+ | --- | --- | --- |
123
+ | Launch plan | Maya | Ready |
124
+ | Support guide | Jordan | In progress |
125
+ ```
126
+
127
+ Render it with:
128
+
129
+ ```powershell
130
+ uvx markdown-docx project-brief.md project-brief.docx
131
+ ```
132
+
133
+ If no `--template` is provided, the packaged blank template supplies the default styles and document settings.
134
+
135
+ ## Use a Word template
136
+
137
+ A custom template lets an organization control styles, theme data, fonts, numbering definitions, and section defaults while the Markdown remains focused on content. Inspect a template before writing the document, then use only the styles it provides.
138
+
139
+ The template must be a blank `.docx` formatting template. `.dotx` is not supported. Inspect it before writing Markdown that refers to its style names:
140
+
141
+ ```powershell
142
+ uvx markdown-docx --inspect-template --template formatting.docx
143
+ uvx markdown-docx --list-styles --template formatting.docx
144
+ uvx markdown-docx --list-table-styles --template formatting.docx
145
+ ```
146
+
147
+ Then render with the template:
148
+
149
+ ```powershell
150
+ uvx markdown-docx report.md report.docx --template formatting.docx
151
+ ```
152
+
153
+ The template remains unchanged. It must not contain:
154
+
155
+ - Non-whitespace body text
156
+ - Body tables
157
+ - Body images or drawings
158
+ - Nonempty headers or footers
159
+
160
+ Each configured style must exist and have the correct Word style type. Body and heading font overrides modify the mapped paragraph styles. The monospace override applies to code blocks and inline code. Sizes, colors, spacing, borders, and other typography remain owned by the template.
161
+
162
+ ## Customize a document
163
+
164
+ Word-specific settings use reserved `markdown-docx` HTML comments. Normal Markdown renderers hide these comments and continue to display the document content.
165
+
166
+ Document metadata sets document-wide defaults:
167
+
168
+ | Key | Purpose |
169
+ | --- | --- |
170
+ | `page_size` | Select `letter`, `legal`, `a4`, or custom dimensions |
171
+ | `orientation` | Select portrait or landscape orientation |
172
+ | `margins` | Set the top, right, bottom, and left margins |
173
+ | `styles` | Map Markdown constructs to Word style names |
174
+ | `fonts` | Set body, heading, and monospace fonts |
175
+
176
+ Content directives control the following block:
177
+
178
+ | Directive | Purpose |
179
+ | --- | --- |
180
+ | `section` | Start a next-page Word section with layout overrides |
181
+ | `table` | Set table style, width, alignment, and column ratios |
182
+ | `image` | Set standalone image width and alignment |
183
+ | `page-break` | Start the next content block on a new page |
184
+
185
+ Only HTML comments beginning with `markdown-docx` are accepted. All other raw HTML and HTML comments are errors. Metadata uses strict YAML. Duplicate keys, unknown keys, invalid types, unitless lengths, and misplaced comments are errors.
186
+
187
+ Run `uvx markdown-docx --syntax` for the complete schema, accepted values, and examples.
188
+
189
+ ### Document settings
190
+
191
+ Document metadata may appear once. It must be the first non-whitespace content:
192
+
193
+ ```markdown
194
+ <!-- markdown-docx
195
+ document:
196
+ page_size: letter
197
+ orientation: portrait
198
+ margins:
199
+ top: 0.75in
200
+ right: 0.75in
201
+ bottom: 0.75in
202
+ left: 0.75in
203
+ fonts:
204
+ body: Calibri
205
+ headings: Calibri
206
+ monospace: Consolas
207
+ -->
208
+
209
+ # Project brief
210
+
211
+ This remains ordinary Markdown.
212
+ ```
213
+
214
+ Named page sizes are `letter`, `legal`, and `a4`. Custom page sizes use nominal portrait dimensions. Their width must not exceed their height. Lengths accept `in`, `cm`, `mm`, and `pt`. Margins must leave a positive usable page area.
215
+
216
+ The `styles` mapping assigns Word paragraph and table styles to semantic Markdown constructs. Ordered and unordered list styles are arrays, with one Word style for each supported nesting depth.
217
+
218
+ ### Sections and page breaks
219
+
220
+ A section directive starts a next-page Word section before the following content block:
221
+
222
+ ```markdown
223
+ <!-- markdown-docx
224
+ section:
225
+ orientation: landscape
226
+ margins:
227
+ top: 0.75in
228
+ right: 0.75in
229
+ bottom: 0.75in
230
+ left: 0.75in
231
+ -->
232
+
233
+ ## Landscape analysis
234
+ ```
235
+
236
+ Each section starts from the document defaults and applies its own overrides. It does not inherit omitted values from the preceding section. Reset to the document defaults with:
237
+
238
+ ```markdown
239
+ <!-- markdown-docx
240
+ section: default
241
+ -->
242
+ ```
243
+
244
+ To insert a page break without creating a section:
245
+
246
+ ```markdown
247
+ <!-- markdown-docx: page-break -->
248
+
249
+ ## Appendix
250
+ ```
251
+
252
+ ### Tables
253
+
254
+ Standard pipe tables become editable Word tables. Put optional table metadata immediately before the table:
255
+
256
+ ```markdown
257
+ <!-- markdown-docx
258
+ table:
259
+ style: Table Grid
260
+ alignment: center
261
+ width: page
262
+ column_widths: [3, 1, 1]
263
+ -->
264
+
265
+ | Item | Count | Price |
266
+ | --- | ---: | ---: |
267
+ | Widget | 2 | $10 |
268
+ ```
269
+
270
+ The first Markdown row is the semantic header row. Cell alignment follows the Markdown delimiter row. `column_widths` contains positive ratios and must match the column count. `width: page` uses the active section's usable width. `width: auto` lets Word size the table unless ratios are supplied.
271
+
272
+ Merged cells, nested tables, fixed row heights, repeated-header controls, and per-cell border or fill metadata are not supported.
273
+
274
+ ### Images
275
+
276
+ Relative paths resolve from the Markdown file's directory:
277
+
278
+ ```markdown
279
+ Text before ![Status icon](images/status.png) text after.
280
+ ```
281
+
282
+ Put metadata immediately before a standalone image:
283
+
284
+ ```markdown
285
+ <!-- markdown-docx
286
+ image:
287
+ width: 40%
288
+ alignment: center
289
+ -->
290
+ ![Architecture](images/architecture.png)
291
+ ```
292
+
293
+ Widths accept `in`, `cm`, `mm`, `pt`, or a percentage of the active section's usable width. Images preserve aspect ratio. Natural-size images are clamped to the usable width. An explicit physical width that exceeds the usable width is an error.
294
+
295
+ HTTP and HTTPS images use timeouts, a 25 MiB download limit, content-type validation, a 50 megapixel decode limit, and one download per unique URL. Reject remote images for offline builds or untrusted input:
296
+
297
+ ```powershell
298
+ uvx markdown-docx report.md --no-remote-images
299
+ ```
300
+
301
+ ### Lists
302
+
303
+ Ordered and unordered lists may be mixed and nested. Each list type maps to one Word paragraph style per nesting depth:
304
+
305
+ ```yaml
306
+ styles:
307
+ ordered_list:
308
+ - List Number
309
+ - List Number 2
310
+ - List Number 3
311
+ unordered_list:
312
+ - List Bullet
313
+ - List Bullet 2
314
+ - List Bullet 3
315
+ ```
316
+
317
+ A list deeper than the configured style array is an error. Ordered lists must begin with `1`. Restart controls and arbitrary start values are not supported.
318
+
319
+ ## Styles and supported content
320
+
321
+ The packaged template provides these default style mappings. Supplied templates may use different style names.
322
+
323
+ | Content | Default Word style |
324
+ | --- | --- |
325
+ | Paragraph | `Normal` |
326
+ | Headings | `Heading 1` through `Heading 6` |
327
+ | Blockquote | `Quote` |
328
+ | Code block | `Code Block` |
329
+ | Ordered lists | `List Number` through `List Number 3` |
330
+ | Unordered lists | `List Bullet` through `List Bullet 3` |
331
+ | Table | `Table Grid` |
332
+
333
+ The current release supports:
334
+
335
+ - ATX headings from `#` through `######`
336
+ - Paragraphs and standard soft or hard line breaks
337
+ - Emphasis, strong emphasis, and inline backtick code
338
+ - Markdown links with formatted labels and optional titles
339
+ - Fenced code blocks
340
+ - Blockquotes containing paragraphs
341
+ - Ordered and unordered lists, including mixed nesting
342
+ - Pipe tables with inline text formatting
343
+ - Local and remote inline images
344
+ - Standalone images with width and alignment metadata
345
+
346
+ The following syntax is intentionally unsupported:
347
+
348
+ - Raw HTML and non-reserved HTML comments
349
+ - Setext headings and horizontal rules
350
+ - Indented code blocks
351
+ - Task lists and footnotes
352
+ - Multi-paragraph list items
353
+ - Tables, images, code blocks, or blockquotes nested inside list items
354
+ - Images inside table cells or blockquotes
355
+ - Arbitrary Markdown extensions
356
+
357
+ Links such as `[link text](https://example.com)` become native, clickable, editable Word hyperlinks. Labels preserve bold, italic, inline code, and line breaks. Optional Markdown titles become Word tooltips. Links work in paragraphs, headings, blockquotes, lists, and table cells. Reference links, angle-bracket autolinks, email links, relative file links, and linked inline images are supported wherever their content is allowed. Destinations are stored without fetching them. Relative file links are resolved by Word relative to the output document. Bare URLs remain plain text. Empty destinations and document-local links such as `[heading](#heading)` are rejected. Heading bookmarks are not generated.
358
+
359
+ ```markdown
360
+ Read the [**project documentation**](https://example.com/docs "Read the guide").
361
+ Contact [the team](mailto:team@example.com).
362
+ ```
363
+
364
+ The source alt text for images remains meaningful Markdown content, but `python-docx` 1.2.0 has no public API for embedding it in a Word drawing. A rendered document containing images reports `image_alt_text_not_embedded` in its warning list.
365
+
366
+ ## Automation and safety
367
+
368
+ ### Structured results and overwrite safety
369
+
370
+ Use `--json` for one complete machine-readable result:
371
+
372
+ ```powershell
373
+ uvx markdown-docx report.md report.docx --json
374
+ ```
375
+
376
+ A successful result contains the input path, output path, template identifier, section count, and warnings. It does not report a page count. DOCX files do not have a reliable intrinsic page count until a compatible layout engine paginates them.
377
+
378
+ The CLI refuses to overwrite an existing output. Add `--force` only when replacement is intended:
379
+
380
+ ```powershell
381
+ uvx markdown-docx report.md report.docx --force --json
382
+ ```
383
+
384
+ ### Remote images and stdin
385
+
386
+ Use `--no-remote-images` for offline builds or untrusted Markdown. Download assets ahead of time and use local paths when reproducible builds matter.
387
+
388
+ For stdin, provide both an output path and a base directory:
389
+
390
+ ```powershell
391
+ Get-Content report.md | uvx markdown-docx --input - --output report.docx --base-dir .
392
+ ```
393
+
394
+ ## Reference
395
+
396
+ Useful discovery and metadata commands:
397
+
398
+ ```powershell
399
+ uvx markdown-docx --help
400
+ uvx markdown-docx --syntax
401
+ uvx markdown-docx --inspect-template --template formatting.docx
402
+ uvx markdown-docx --list-styles --template formatting.docx
403
+ uvx markdown-docx --list-table-styles --template formatting.docx
404
+ uvx markdown-docx --about
405
+ uvx markdown-docx --version
406
+ ```
407
+
408
+ Exit codes:
409
+
410
+ | Code | Meaning |
411
+ | ---: | --- |
412
+ | `0` | Success |
413
+ | `2` | Usage or input error |
414
+ | `3` | Markdown or metadata parse error |
415
+ | `4` | Template or style error |
416
+ | `5` | Image or asset error |
417
+ | `6` | Unsupported Markdown or feature |
418
+ | `7` | DOCX rendering error |
419
+ | `8` | Unexpected internal error |
420
+
421
+ ### Manage the agent skill
422
+
423
+ The standard location is `~/.agents/skills/markdown-docx/SKILL.md`. Inspect the installed skill without changing it:
424
+
425
+ ```powershell
426
+ uvx markdown-docx skill status
427
+ uvx markdown-docx skill status --json
428
+ ```
429
+
430
+ Normal commands synchronize an already-installed managed skill when it is eligible. Synchronization is local. It does not query a package index, refresh uv's cache, or update the CLI. Missing, unmanaged, modified, unverifiable, equal-version, and newer skills are preserved.
431
+
432
+ To replace managed edits intentionally or recover an older managed skill:
433
+
434
+ ```powershell
435
+ uvx markdown-docx skill install --force
436
+ ```
437
+
438
+ Install `--force` still refuses unmanaged content and never downgrades a newer skill. Custom directories require explicit updates:
439
+
440
+ ```powershell
441
+ uvx markdown-docx skill install --skills-dir PATH
442
+ uvx markdown-docx skill status --skills-dir PATH
443
+ uvx --from . markdown-docx skill install
444
+ ```
445
+
446
+ Remove the skill with `uvx markdown-docx skill remove`. Removal refuses unmanaged content and extra files unless `--force` is supplied. All skill commands accept `--skills-dir` and `--json`. Skill commands never trigger automatic synchronization. Maintenance notices go to stderr and leave JSON stdout intact.
447
+
448
+ See [skill lifecycle metadata and decisions](docs/skill-management.md) for the integrity format, version decisions, and recovery rules.
449
+
450
+ ## Examples
451
+
452
+ - [Showcase Markdown source](sample/showcase.md)
453
+ - [Generated editable Word document](sample/showcase.docx)
454
+ - [Rendered first page](sample/assets/showcase-page-1.png)
455
+ - [Workflow illustration](sample/assets/word-workflow.png)
456
+
457
+ The showcase opens with an illustrated three-dog story, then exercises supported text, list, table, image, page-break, and section behavior in a dedicated capability lab.
458
+
459
+ Regenerate it from a repository checkout:
460
+
461
+ ```powershell
462
+ uvx --refresh --from . markdown-docx sample\showcase.md sample\showcase.docx --force
463
+ ```
464
+
465
+ ## Design and compatibility
466
+
467
+ Production code uses documented public `python-docx` APIs with one isolated exception. `src/markdown_docx/hyperlinks.py` creates native hyperlink OOXML because `python-docx` 1.2.0 has no public hyperlink creation API. Run formatting, styles, relationship registration, and document saving use library APIs. Replace this helper when upstream supports hyperlink creation. Tests enforce the boundary and inspect generated package XML read-only. See [public API capabilities](docs/public-api-capabilities.md) for the complete decision record.
468
+
469
+ Word is the primary compatibility target. LibreOffice Writer is used as a visual smoke-test engine. Differences in pagination or font metrics can occur between layout engines.
470
+
471
+ ## Development
472
+
473
+ Install the development environment and run the checks:
474
+
475
+ ```powershell
476
+ $env:UV_LINK_MODE="copy"
477
+ uv sync --locked --all-groups
478
+ uv run pytest
479
+ uv run ruff check .
480
+ uv run ruff format --check .
481
+ uv run mypy
482
+ ```
483
+
484
+ Build and validate distributions:
485
+
486
+ ```powershell
487
+ uv build
488
+ uv run twine check dist/*
489
+ ```