mdhtml2docx 0.1.4__tar.gz → 0.1.6__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 (43) hide show
  1. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/PKG-INFO +30 -32
  2. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/README.md +26 -25
  3. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/mdhtml2docx/__init__.py +3 -1
  4. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/mdhtml2docx/hilite.py +1 -4
  5. mdhtml2docx-0.1.6/mdhtml2docx/mdhtml2docx.py +602 -0
  6. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/mdhtml2docx/styles.py +2 -4
  7. mdhtml2docx-0.1.6/mdhtml2docx/templates/reference.docx +0 -0
  8. mdhtml2docx-0.1.6/mdhtml2docx/wml.py +30 -0
  9. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/mdhtml2docx.egg-info/PKG-INFO +30 -32
  10. mdhtml2docx-0.1.6/mdhtml2docx.egg-info/SOURCES.txt +16 -0
  11. mdhtml2docx-0.1.6/mdhtml2docx.egg-info/requires.txt +9 -0
  12. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/pyproject.toml +4 -10
  13. mdhtml2docx-0.1.6/tests/test_check_docx.py +11 -0
  14. mdhtml2docx-0.1.6/tests/test_convert.py +336 -0
  15. mdhtml2docx-0.1.4/mdhtml2docx/asvocab.py +0 -91
  16. mdhtml2docx-0.1.4/mdhtml2docx/mdhtml2docx.py +0 -832
  17. mdhtml2docx-0.1.4/mdhtml2docx/schemas/SOURCES.md +0 -7
  18. mdhtml2docx-0.1.4/mdhtml2docx/schemas/dml-chart.xsd +0 -1499
  19. mdhtml2docx-0.1.4/mdhtml2docx/schemas/dml-chartDrawing.xsd +0 -146
  20. mdhtml2docx-0.1.4/mdhtml2docx/schemas/dml-diagram.xsd +0 -1085
  21. mdhtml2docx-0.1.4/mdhtml2docx/schemas/dml-lockedCanvas.xsd +0 -11
  22. mdhtml2docx-0.1.4/mdhtml2docx/schemas/dml-main.xsd +0 -3081
  23. mdhtml2docx-0.1.4/mdhtml2docx/schemas/dml-picture.xsd +0 -23
  24. mdhtml2docx-0.1.4/mdhtml2docx/schemas/dml-wordprocessingDrawing.xsd +0 -287
  25. mdhtml2docx-0.1.4/mdhtml2docx/schemas/shared-commonSimpleTypes.xsd +0 -172
  26. mdhtml2docx-0.1.4/mdhtml2docx/schemas/shared-customXmlSchemaProperties.xsd +0 -18
  27. mdhtml2docx-0.1.4/mdhtml2docx/schemas/shared-math.xsd +0 -582
  28. mdhtml2docx-0.1.4/mdhtml2docx/schemas/shared-relationshipReference.xsd +0 -25
  29. mdhtml2docx-0.1.4/mdhtml2docx/schemas/wml.xsd +0 -3643
  30. mdhtml2docx-0.1.4/mdhtml2docx/schemas/xml.xsd +0 -287
  31. mdhtml2docx-0.1.4/mdhtml2docx/templates/reference.docx +0 -0
  32. mdhtml2docx-0.1.4/mdhtml2docx/validate.py +0 -42
  33. mdhtml2docx-0.1.4/mdhtml2docx/wml.py +0 -100
  34. mdhtml2docx-0.1.4/mdhtml2docx/word.py +0 -136
  35. mdhtml2docx-0.1.4/mdhtml2docx/word.sdef +0 -9661
  36. mdhtml2docx-0.1.4/mdhtml2docx.egg-info/SOURCES.txt +0 -34
  37. mdhtml2docx-0.1.4/mdhtml2docx.egg-info/requires.txt +0 -13
  38. mdhtml2docx-0.1.4/tests/test_convert.py +0 -638
  39. mdhtml2docx-0.1.4/tests/test_validate.py +0 -34
  40. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/LICENSE +0 -0
  41. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/mdhtml2docx.egg-info/dependency_links.txt +0 -0
  42. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/mdhtml2docx.egg-info/top_level.txt +0 -0
  43. {mdhtml2docx-0.1.4 → mdhtml2docx-0.1.6}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: mdhtml2docx
3
- Version: 0.1.4
3
+ Version: 0.1.6
4
4
  Summary: Convert MDHTML to Word docx files
5
5
  Author-email: Jeremy Howard <j@fast.ai>
6
6
  License-Expression: Apache-2.0
@@ -10,13 +10,10 @@ Classifier: Programming Language :: Python :: 3 :: Only
10
10
  Requires-Python: >=3.10
11
11
  Description-Content-Type: text/markdown
12
12
  License-File: LICENSE
13
- Requires-Dist: mdhtml>=0.1.39
14
- Requires-Dist: fast5ever>=0.1.5
15
- Requires-Dist: oxml>=0.1.1
16
- Provides-Extra: validation
17
- Requires-Dist: lxml; extra == "validation"
13
+ Requires-Dist: mdhtml>=0.1.44
14
+ Requires-Dist: oxml>=0.1.4
18
15
  Provides-Extra: dev
19
- Requires-Dist: mdhtml2docx[validation]; extra == "dev"
16
+ Requires-Dist: lxml; extra == "dev"
20
17
  Requires-Dist: pytest; extra == "dev"
21
18
  Requires-Dist: fastship; extra == "dev"
22
19
  Requires-Dist: build; extra == "dev"
@@ -25,35 +22,34 @@ Dynamic: license-file
25
22
 
26
23
  # mdhtml2docx
27
24
 
28
- Convert [MDHTML](https://github.com/AnswerDotAI/mdhtml) to Word docx files.
25
+ Write [mdhtml](https://github.com/AnswerDotAI/mdhtml) documents as Word docx files.
29
26
 
30
- `mdhtml` renders Markdown to an HTML5 document format shared by format-specific exporters. `mdhtml2docx` converts its portable core to docx from scratch. It uses [fast5ever](https://github.com/AnswerDotAI/fast5ever)'s mutable WHATWG DOM for input and `oxml` for WordprocessingML construction, reference editing, DOCX packaging, and atomic saving. XML construction uses namespace-bound factories such as `e.tcW(type='dxa', w=2400)`, backed by fastcore's XML builder. Conversion requires neither lxml nor a .NET or Office runtime.
27
+ `mdhtml2docx` consumes mdhtml's semantic `Document` API. The shared importer handles HTML5 parsing, raw-data decoding, and document structure. The shared reference index validates and plans references. `oxml` provides WordprocessingML construction, reference editing, DOCX packaging, and atomic saving. XML construction uses namespace-bound factories such as `e.tcW(type='dxa', w=2400)`, backed by fastcore's XML builder. Conversion requires neither lxml nor a .NET or Office runtime.
31
28
 
32
- MDHTML accepts the full HTML vocabulary. This exporter supports the elements and annotations listed below. It preserves the text of unknown inline elements and recurses through block containers. It returns a warning when an unsupported block must become a plain paragraph. HTML parsing and repair belong to `mdhtml`.
29
+ MDHTML accepts the full HTML vocabulary. This exporter supports the elements and annotations listed below. It preserves the text of unknown inline elements and recurses through block containers. HTML parsing and repair belong to `mdhtml`.
33
30
 
34
31
  ## Usage
35
32
 
36
33
  ```python
37
- from mdhtml import md2mdhtml
34
+ from mdhtml import parse_md
38
35
  from mdhtml2docx import mdhtml2docx
39
36
 
40
- html = md2mdhtml(markdown_text)
41
- warnings = mdhtml2docx(html, 'out.docx')
37
+ document = parse_md(markdown_text)
38
+ warnings = mdhtml2docx(document, 'out.docx')
42
39
  ```
43
40
 
44
- `mdhtml2docx` takes an MDHTML string, writes a docx, and returns a list of warning strings. It parses strings with `mdhtml.mdhtml2dom`. Normal HTML5 repair applies; the input need not be well-formed XML.
41
+ `mdhtml2docx` accepts a semantic `Document` or symbolic MDHTML, writes a docx, and returns warning strings. Normal HTML5 repair applies when importing MDHTML; the input need not be well-formed XML.
45
42
 
46
- You can also pass an existing mutable fast5ever DOM:
43
+ Import existing MDHTML through the same document API:
47
44
 
48
45
  ```python
49
- from mdhtml import mdhtml2dom
46
+ from mdhtml import Document
50
47
 
51
- document = mdhtml2dom(html)
52
- document.children[0].attrs['custom-style'] = 'Contract Title'
48
+ document = Document.from_mdhtml(html)
53
49
  warnings = mdhtml2docx(document, 'out.docx')
54
50
  ```
55
51
 
56
- Body-position text and phrasing content become implicit Word paragraphs. Whitespace between blocks does not produce content. HTML templates are not rendered.
52
+ The importer groups body-position text and phrasing content into paragraphs. The exporter reads ordinary dictionary snapshots of the semantic blocks, inlines, and note definitions. Operation arguments remain inert unless an operation renderer selects them.
57
53
 
58
54
  ## Supported content
59
55
 
@@ -71,6 +67,8 @@ A `details` div becomes its label as a bold line above the body. It does not bec
71
67
 
72
68
  Math spans and blocks become native Word math zones (`m:oMath`). These contain the source text unchanged, whether TeX, UnicodeMath, or AsciiMath. Math build-up and rendering are left to downstream tools. Pandoc reads the zones back as math.
73
69
 
70
+ An id-bearing display equation receives a live `Equation N` caption below its math zone. Unlabelled equations remain unnumbered.
71
+
74
72
  When [fastpylight](https://github.com/AnswerDotAI/fastpylight) is installed, code blocks with a language use syntax coloring. Tokens receive `Hl*` character styles such as `Hl Keyword`. Their colors come from the reference theme described below. You can restyle them in Word.
75
73
 
76
74
  ## Styling
@@ -114,13 +112,7 @@ The converter accepts MDHTML raw data with `data-format="docx"`:
114
112
 
115
113
  A ```` ```{=docx} ```` fenced block in Markdown, or inline code followed by `{=docx}`, produces this element. The payload is parsed as WordprocessingML and inserted verbatim. Block payloads contain elements such as `w:p` or `w:tbl`. Inline payloads contain elements such as `w:r`. The prefixes `w`, `r`, `wp`, `a`, `pic`, and `m` are predeclared.
116
114
 
117
- Payload encoding follows these rules:
118
-
119
- - No `data-encoding`: use the literal payload.
120
- - `data-encoding="html"`: perform one character-reference decoding pass.
121
- - `data-encoding="base64"`: decode a base64-encoded UTF-8 payload.
122
-
123
- Malformed payloads and unknown encodings are dropped with a warning. Raw data for other formats is skipped silently.
115
+ The shared mdhtml importer decodes payloads according to its raw-data contract. This exporter parses decoded `docx` payloads as WordprocessingML. Invalid encodings and malformed XML produce warnings. Other formats are skipped.
124
116
 
125
117
  For example, insert a page break with:
126
118
 
@@ -130,6 +122,8 @@ For example, insert a page break with:
130
122
 
131
123
  ## Cross-references
132
124
 
125
+ Bibliographies and citations use mdhtml's shared Rust preparation. `::: bibliography` entries contain citation-author terms with ids and optional `year` attributes, followed by their formatted definitions. Citations use `[@key]`, narrative `{ref=text}`, author-suppressing `-@`, and per-item prefix/suffix text. `cite_style='numeric'` selects numbers in bibliography order; `'author-year'` selects author-year text. None inherits frontmatter. Citations become static linked text and bibliography entries retain their bookmarks. Section, page, figure and table cross-references remain native Word fields. Re-export the original document to change citation style.
126
+
133
127
  Markdown references such as `[@sec-payment]` become live Word REF fields. MDHTML represents them as `a` elements with `data-ref`.
134
128
 
135
129
  The default field is `REF <bookmark> \w \h`. It displays the full-context paragraph number, such as "3.(c)(iii)", as a hyperlink. The converter sets `updateFields` in `settings.xml` so Word refreshes fields on open.
@@ -150,7 +144,7 @@ A missing target id raises a conversion error. A reference type with no defined
150
144
 
151
145
  Number fields require numbered headings. If your reference docx already numbers its heading styles, the converter leaves that numbering unchanged.
152
146
 
153
- Otherwise, select a scheme with `number_headings`:
147
+ The shared reference index resolves `number_headings` against document metadata. Numeric heading references infer decimal numbering when no scheme is supplied. You can select a scheme explicitly:
154
148
 
155
149
  - `'legal'` uses 1. / (a) / (i) numbering.
156
150
  - `'decimal'` uses 1. / 1.1. / 1.1.1. numbering.
@@ -160,18 +154,22 @@ The named schemes come from mdhtml's `SCHEMES`. The custom dictionary uses the s
160
154
 
161
155
  A reference-list entry ending in `.xml` can also supply styles and numbering. It contains raw `w:style`, `w:abstractNum`, and `w:num` elements. Each contributor's ids and references are remapped before merging, so separate contributors can reuse the same original numbering ids; later styles still win.
162
156
 
163
- ### Figures and tables
157
+ ### Figures, tables, and equations
158
+
159
+ Figures, captioned tables, and id-bearing display equations use independent live SEQ fields. A figure's caption appears below its body as "Figure 1: caption". A table's caption appears above it as "Table 1: caption". Equations receive an "Equation 1" caption below the math zone. Labels come from `reftypes`; changing a label never merges the counters.
164
160
 
165
- Figures and captioned tables use live SEQ fields. A figure's caption appears below its image as "Figure 1: caption", using the caption style. A table's caption appears above it as "Table 1: caption".
161
+ When the element has an id, the converter bookmarks its label, number, and authored caption separately. The shared reference planner supplies prefix words; each Word REF field supplies only the live number. Thus `[@fig-plot]` displays "Figure 1", while `[-@tbl-stages]` displays only the number.
166
162
 
167
- When the element has an id, the converter bookmarks its label and number. `[@fig-plot]` inserts "Figure 1" from that bookmark without adding another prefix. A second, number-only bookmark supplies the bare number for references such as `[-@tbl-stages]`.
163
+ Figure and table `{ref=text}` references use a separate bookmark containing the authored caption text. Generated bookmark names are reserved through the same collision-safe allocator as authored targets, including forward references. Equation references support full labels, bare numbers, and pages. `{ref=text}` to equation source is not supported by the Word exporter.
168
164
 
169
- `fig` and `tbl` are built-in reference types alongside `sec`. Their labels come from the same `reftypes` table. Same-type groups pluralize once. Mixed-type groups use each item's singular prefix, as in "Figure 1 and Table 2".
165
+ `fig`, `tbl`, and `eq` are built-in reference types alongside `sec`. Grouped references use the shared planner's plural prefixes and separators, such as "Figures 1 and 2".
170
166
 
171
- Reference targets must be headings, paragraphs, figures, or tables with ids. A reference to anything else raises a conversion error.
167
+ Reference targets include headings, paragraphs, figures, tables, equations, spans, and definition terms with ids. Paragraphs support text and page references; spans and definition terms support text and page references. Target and variant validation belongs to mdhtml.
172
168
 
173
169
  ## Validation
174
170
 
175
171
  Independent schema validation is optional. Install `mdhtml2docx[validation]` to use `mdhtml2docx.validate.fast_checks(path)`; this extra requires lxml. Normal conversion does not import it.
176
172
 
177
173
  The test suite checks docx containers, CRCs, and XML, validates against the ECMA-376 schemas with lxml, and performs semantic round trips through Pandoc's independent docx reader. Periodic acceptance runs open documents in Microsoft Word through AppleScript.
174
+
175
+ Live Word scripting is provided by [macscript](https://github.com/AnswerDotAI/macscript), not the converter. The development-only `tools/check_docx.py` combines `oxml` validation with a live Word acceptance check; see "Live Word checks" in [DEV.md](DEV.md). Normal installation and conversion do not require macscript or Office.
@@ -1,34 +1,33 @@
1
1
  # mdhtml2docx
2
2
 
3
- Convert [MDHTML](https://github.com/AnswerDotAI/mdhtml) to Word docx files.
3
+ Write [mdhtml](https://github.com/AnswerDotAI/mdhtml) documents as Word docx files.
4
4
 
5
- `mdhtml` renders Markdown to an HTML5 document format shared by format-specific exporters. `mdhtml2docx` converts its portable core to docx from scratch. It uses [fast5ever](https://github.com/AnswerDotAI/fast5ever)'s mutable WHATWG DOM for input and `oxml` for WordprocessingML construction, reference editing, DOCX packaging, and atomic saving. XML construction uses namespace-bound factories such as `e.tcW(type='dxa', w=2400)`, backed by fastcore's XML builder. Conversion requires neither lxml nor a .NET or Office runtime.
5
+ `mdhtml2docx` consumes mdhtml's semantic `Document` API. The shared importer handles HTML5 parsing, raw-data decoding, and document structure. The shared reference index validates and plans references. `oxml` provides WordprocessingML construction, reference editing, DOCX packaging, and atomic saving. XML construction uses namespace-bound factories such as `e.tcW(type='dxa', w=2400)`, backed by fastcore's XML builder. Conversion requires neither lxml nor a .NET or Office runtime.
6
6
 
7
- MDHTML accepts the full HTML vocabulary. This exporter supports the elements and annotations listed below. It preserves the text of unknown inline elements and recurses through block containers. It returns a warning when an unsupported block must become a plain paragraph. HTML parsing and repair belong to `mdhtml`.
7
+ MDHTML accepts the full HTML vocabulary. This exporter supports the elements and annotations listed below. It preserves the text of unknown inline elements and recurses through block containers. HTML parsing and repair belong to `mdhtml`.
8
8
 
9
9
  ## Usage
10
10
 
11
11
  ```python
12
- from mdhtml import md2mdhtml
12
+ from mdhtml import parse_md
13
13
  from mdhtml2docx import mdhtml2docx
14
14
 
15
- html = md2mdhtml(markdown_text)
16
- warnings = mdhtml2docx(html, 'out.docx')
15
+ document = parse_md(markdown_text)
16
+ warnings = mdhtml2docx(document, 'out.docx')
17
17
  ```
18
18
 
19
- `mdhtml2docx` takes an MDHTML string, writes a docx, and returns a list of warning strings. It parses strings with `mdhtml.mdhtml2dom`. Normal HTML5 repair applies; the input need not be well-formed XML.
19
+ `mdhtml2docx` accepts a semantic `Document` or symbolic MDHTML, writes a docx, and returns warning strings. Normal HTML5 repair applies when importing MDHTML; the input need not be well-formed XML.
20
20
 
21
- You can also pass an existing mutable fast5ever DOM:
21
+ Import existing MDHTML through the same document API:
22
22
 
23
23
  ```python
24
- from mdhtml import mdhtml2dom
24
+ from mdhtml import Document
25
25
 
26
- document = mdhtml2dom(html)
27
- document.children[0].attrs['custom-style'] = 'Contract Title'
26
+ document = Document.from_mdhtml(html)
28
27
  warnings = mdhtml2docx(document, 'out.docx')
29
28
  ```
30
29
 
31
- Body-position text and phrasing content become implicit Word paragraphs. Whitespace between blocks does not produce content. HTML templates are not rendered.
30
+ The importer groups body-position text and phrasing content into paragraphs. The exporter reads ordinary dictionary snapshots of the semantic blocks, inlines, and note definitions. Operation arguments remain inert unless an operation renderer selects them.
32
31
 
33
32
  ## Supported content
34
33
 
@@ -46,6 +45,8 @@ A `details` div becomes its label as a bold line above the body. It does not bec
46
45
 
47
46
  Math spans and blocks become native Word math zones (`m:oMath`). These contain the source text unchanged, whether TeX, UnicodeMath, or AsciiMath. Math build-up and rendering are left to downstream tools. Pandoc reads the zones back as math.
48
47
 
48
+ An id-bearing display equation receives a live `Equation N` caption below its math zone. Unlabelled equations remain unnumbered.
49
+
49
50
  When [fastpylight](https://github.com/AnswerDotAI/fastpylight) is installed, code blocks with a language use syntax coloring. Tokens receive `Hl*` character styles such as `Hl Keyword`. Their colors come from the reference theme described below. You can restyle them in Word.
50
51
 
51
52
  ## Styling
@@ -89,13 +90,7 @@ The converter accepts MDHTML raw data with `data-format="docx"`:
89
90
 
90
91
  A ```` ```{=docx} ```` fenced block in Markdown, or inline code followed by `{=docx}`, produces this element. The payload is parsed as WordprocessingML and inserted verbatim. Block payloads contain elements such as `w:p` or `w:tbl`. Inline payloads contain elements such as `w:r`. The prefixes `w`, `r`, `wp`, `a`, `pic`, and `m` are predeclared.
91
92
 
92
- Payload encoding follows these rules:
93
-
94
- - No `data-encoding`: use the literal payload.
95
- - `data-encoding="html"`: perform one character-reference decoding pass.
96
- - `data-encoding="base64"`: decode a base64-encoded UTF-8 payload.
97
-
98
- Malformed payloads and unknown encodings are dropped with a warning. Raw data for other formats is skipped silently.
93
+ The shared mdhtml importer decodes payloads according to its raw-data contract. This exporter parses decoded `docx` payloads as WordprocessingML. Invalid encodings and malformed XML produce warnings. Other formats are skipped.
99
94
 
100
95
  For example, insert a page break with:
101
96
 
@@ -105,6 +100,8 @@ For example, insert a page break with:
105
100
 
106
101
  ## Cross-references
107
102
 
103
+ Bibliographies and citations use mdhtml's shared Rust preparation. `::: bibliography` entries contain citation-author terms with ids and optional `year` attributes, followed by their formatted definitions. Citations use `[@key]`, narrative `{ref=text}`, author-suppressing `-@`, and per-item prefix/suffix text. `cite_style='numeric'` selects numbers in bibliography order; `'author-year'` selects author-year text. None inherits frontmatter. Citations become static linked text and bibliography entries retain their bookmarks. Section, page, figure and table cross-references remain native Word fields. Re-export the original document to change citation style.
104
+
108
105
  Markdown references such as `[@sec-payment]` become live Word REF fields. MDHTML represents them as `a` elements with `data-ref`.
109
106
 
110
107
  The default field is `REF <bookmark> \w \h`. It displays the full-context paragraph number, such as "3.(c)(iii)", as a hyperlink. The converter sets `updateFields` in `settings.xml` so Word refreshes fields on open.
@@ -125,7 +122,7 @@ A missing target id raises a conversion error. A reference type with no defined
125
122
 
126
123
  Number fields require numbered headings. If your reference docx already numbers its heading styles, the converter leaves that numbering unchanged.
127
124
 
128
- Otherwise, select a scheme with `number_headings`:
125
+ The shared reference index resolves `number_headings` against document metadata. Numeric heading references infer decimal numbering when no scheme is supplied. You can select a scheme explicitly:
129
126
 
130
127
  - `'legal'` uses 1. / (a) / (i) numbering.
131
128
  - `'decimal'` uses 1. / 1.1. / 1.1.1. numbering.
@@ -135,18 +132,22 @@ The named schemes come from mdhtml's `SCHEMES`. The custom dictionary uses the s
135
132
 
136
133
  A reference-list entry ending in `.xml` can also supply styles and numbering. It contains raw `w:style`, `w:abstractNum`, and `w:num` elements. Each contributor's ids and references are remapped before merging, so separate contributors can reuse the same original numbering ids; later styles still win.
137
134
 
138
- ### Figures and tables
135
+ ### Figures, tables, and equations
136
+
137
+ Figures, captioned tables, and id-bearing display equations use independent live SEQ fields. A figure's caption appears below its body as "Figure 1: caption". A table's caption appears above it as "Table 1: caption". Equations receive an "Equation 1" caption below the math zone. Labels come from `reftypes`; changing a label never merges the counters.
139
138
 
140
- Figures and captioned tables use live SEQ fields. A figure's caption appears below its image as "Figure 1: caption", using the caption style. A table's caption appears above it as "Table 1: caption".
139
+ When the element has an id, the converter bookmarks its label, number, and authored caption separately. The shared reference planner supplies prefix words; each Word REF field supplies only the live number. Thus `[@fig-plot]` displays "Figure 1", while `[-@tbl-stages]` displays only the number.
141
140
 
142
- When the element has an id, the converter bookmarks its label and number. `[@fig-plot]` inserts "Figure 1" from that bookmark without adding another prefix. A second, number-only bookmark supplies the bare number for references such as `[-@tbl-stages]`.
141
+ Figure and table `{ref=text}` references use a separate bookmark containing the authored caption text. Generated bookmark names are reserved through the same collision-safe allocator as authored targets, including forward references. Equation references support full labels, bare numbers, and pages. `{ref=text}` to equation source is not supported by the Word exporter.
143
142
 
144
- `fig` and `tbl` are built-in reference types alongside `sec`. Their labels come from the same `reftypes` table. Same-type groups pluralize once. Mixed-type groups use each item's singular prefix, as in "Figure 1 and Table 2".
143
+ `fig`, `tbl`, and `eq` are built-in reference types alongside `sec`. Grouped references use the shared planner's plural prefixes and separators, such as "Figures 1 and 2".
145
144
 
146
- Reference targets must be headings, paragraphs, figures, or tables with ids. A reference to anything else raises a conversion error.
145
+ Reference targets include headings, paragraphs, figures, tables, equations, spans, and definition terms with ids. Paragraphs support text and page references; spans and definition terms support text and page references. Target and variant validation belongs to mdhtml.
147
146
 
148
147
  ## Validation
149
148
 
150
149
  Independent schema validation is optional. Install `mdhtml2docx[validation]` to use `mdhtml2docx.validate.fast_checks(path)`; this extra requires lxml. Normal conversion does not import it.
151
150
 
152
151
  The test suite checks docx containers, CRCs, and XML, validates against the ECMA-376 schemas with lxml, and performs semantic round trips through Pandoc's independent docx reader. Periodic acceptance runs open documents in Microsoft Word through AppleScript.
152
+
153
+ Live Word scripting is provided by [macscript](https://github.com/AnswerDotAI/macscript), not the converter. The development-only `tools/check_docx.py` combines `oxml` validation with a live Word acceptance check; see "Live Word checks" in [DEV.md](DEV.md). Normal installation and conversion do not require macscript or Office.
@@ -1,4 +1,6 @@
1
- __version__ = "0.1.4"
1
+ __version__ = "0.1.6"
2
+
3
+
2
4
 
3
5
 
4
6
 
@@ -1,7 +1,4 @@
1
- """Optional syntax scopes for code blocks, via fastpylight (Jeremy's tree-sitter highlighter).
2
- When fastpylight is absent or the language unknown, callers fall back to plain runs, so the
3
- package does not require fastpylight. Colors live in the reference doc's Hl* character
4
- styles (see styles.theme_styles); this module only tokenizes."""
1
+ "Optional syntax scopes for code blocks, via fastpylight When fastpylight is absent or the language unknown, callers fall back to plain runs, so the package does not require fastpylight. Colors live in the reference doc's Hl* character styles (see styles.theme_styles); this module only tokenizes."
5
2
 
6
3
  # theme_colors is probed too: a pre-theme_colors fastpylight is treated as absent, not half-working
7
4
  try: from fastpylight import tokenize, theme_colors # chkstyle: ignore