feat(docx): add hi-fidelity XML injections for tables, styles, lists, and sections; extend tools and tests

- Add feature flags: hi-fidelity-tables, hi-fidelity-styles, hi-fidelity-lists, hi-fidelity-sections
- Tables: inject true w:gridSpan/w:vMerge and w:tblGrid widths via post-build XML when enabled
- Styles: ensure TableHeader style in styles.xml; tag first row when headers present
- Lists: robust numbering.xml for ordered/unordered with multi-level definitions
- Sections: write tail w:sectPr with page size/orientation/margins
- Tools: expose new operations (sections, list items, images, hyperlinks, props, redaction, storage)
- Converters: add preference-aware methods for hi-fidelity export paths; HTML export tool
- Tests: add golden XML assertions gated by feature flags; keep default build green

This enables high-fidelity DOCX output while keeping pure-Rust paths by default.
This commit is contained in:
Andy
2025-08-12 23:25:29 +08:00
parent c30f55d16d
commit 90305551cc
14 changed files with 1983 additions and 277 deletions
+6
View File
@@ -57,6 +57,7 @@ usvg = "0.44" # SVG parsing
pulldown-cmark = "0.12" # Markdown parsing
html5ever = "0.29" # HTML parsing
comrak = "0.28" # CommonMark parsing
html-escape = "0.2"
# Text extraction from DOCX
dotext = "0.1"
@@ -107,6 +108,11 @@ pure-rust-pdf = []
external-tools = ["headless_chrome", "wkhtmltopdf"]
full = ["embedded-fonts", "pure-rust-pdf", "external-tools", "tera"]
build-bin = []
hi-fidelity = [] # placeholder feature flag for high-fidelity rendering backends
hi-fidelity-tables = [] # enable XML injection for true table merges/widths
hi-fidelity-sections = [] # enable XML injection for sectPr (page setup)
hi-fidelity-styles = [] # enable XML injection for custom styles (e.g., TableHeader)
hi-fidelity-lists = [] # enable XML injection for robust numbering definitions
[build-dependencies]
anyhow = "1.0"