All of the suite test cases are small fragments of HTML to test specific things, so I probably do need a way to test bigger documents. Thanks for the feedback. I’ll add that to the to-do list.
I’ll try the red hat example later this evening.
Ok, I dug into the Red Hat doc. It’s a great example and it uncovered a few real shortcomings.
A couple of things about this scenario:
First, the page relies on stylesheets, so you need styleSource: "computed", either Playwright on Node, or run in the browser with the content already rendered.
Second, dom-docx doesn’t fetch remote images itself. The caller supplies an imageResolver (e.g. a fetch callback), which keeps security, timeouts, host allowlists, etc. under caller control: https://dom-docx.com/learn#image-resolver
I fixed a few bugs from this (in 0.1.8):
- wide headings inside flex containers getting clipped
- oversized images not scaling down to the printable page width
- OS dark theme (prefers-color-scheme: dark) leaking near-white computed text colors into Word on the browser path
I also added an ad-hoc repo script that loads a live URL, takes a CSS selector, and converts with Playwright (tools/try-url.ts). I used it on the RHEL page and got a pretty decent 200+ page doc. Some tables still look wrong — I’ll dig into those next.
Script: https://github.com/floodtide/dom-docx/blob/main/tools/try-ur...
Example usage from a clone: npx tsx tools/try-url.ts \ "https://docs.redhat.com/en/documentation/red_hat_enterprise_..." \ ".docs-content-container" \ rhel-storage.docx
Thanks for following up. I don't understand why your post has been flagged.