An open-source library that converts semantic HTML into native, fully editable Word documents — real paragraphs, lists, tables, and images, not a screenshot.
Last verified · 2026-07-13 · by Moe Ameen
DOM-docx is an open-source library, published by floodtide on GitHub under the MIT license, that converts semantic HTML fragments into native, editable Word documents in the OOXML (.docx) format. The distinction it leads with is fidelity of structure: instead of rasterizing a page to an image or faking layout, it emits real Word constructs — paragraphs, runs, lists, tables, links, and images — so the resulting file opens in Microsoft Word (or Google Docs, Pages, or LibreOffice) as something a person can actually edit, restyle, and continue working in.
It is written in TypeScript and runs on Node.js 20 or newer. The core stays deliberately light — its main dependencies are `docx`, `cheerio`, and `fflate` — with Playwright as an optional add-on used only for advanced features. The default "inline" style path needs no browser at all. There is a command-line interface (`npx dom-docx input.html -o output.docx`, including stdin/stdout piping for build pipelines), a Node API whose main function `convertHtmlToDocx(html, options?)` resolves to a Buffer, and a browser bundle (`dom-docx/browser`) that returns a Blob for fully client-side conversion.
On the input side it handles headings, paragraphs, ordered and unordered lists, tables, links, inline formatting, blockquotes, horizontal rules, simple flex rows, block backgrounds, and page breaks, plus `data:` images and remote images through an `imageResolver`. On the document side you can set page size, orientation, and margins, a default font, metadata, header and footer HTML, page numbers, a table of contents, language and direction, and a cover page. An optional "computed" style mode (via Playwright/Chromium) resolves `<style>` blocks and CSS classes through `getComputedStyle`, and a rasterize option converts `<canvas>` and complex SVG to PNG when needed.
The honest framing: DOM-docx is a focused conversion primitive, not a content tool or an app. It is early — a v0.1.x release, developer-facing, with documented limits (no external stylesheets on the inline path, no web fonts, no CSS grid or float layout, no forms, and no table `rowspan`). It writes nothing, designs nothing, and publishes nothing; it takes HTML you already have and turns it into a Word file. Verify current capabilities against the GitHub repo, since an early project moves quickly.
DOM-docx solves one narrow, real problem: turning HTML into a Word file someone can edit. It is the export leg. What it can't do is produce that content in the first place, keep it on brand, or get it in front of an audience — and that is exactly the split where Kompozy sits on the other side of the same workflow. Kompozy generates the source. Ask it for a Blog Article or an Email Newsletter and it drafts the full piece — governed by your Persona Brief and banned-word filters so it reads as your brand, not generic model output. That HTML is what you feed DOM-docx to spin out a polished, editable Word version: a gated lead magnet, a client-ready one-pager, or a proposal your team can tweak before it goes out.
The point is that the Word file is a single endpoint, and most content needs many. So while DOM-docx handles the `.docx` deliverable, Kompozy takes the same idea and multiplies it into a week of formats — platform-native Text Posts, a Carousel, Quote Graphics, a Persona Short or avatar video — then schedules and publishes the whole set across nine social platforms plus blog and email from one queue, on autopilot with a per-post review pipeline. A concrete run: Kompozy writes the newsletter, DOM-docx converts it to a downloadable Word guide you offer as an opt-in, and Kompozy simultaneously fans the same message out to Reels, Shorts, LinkedIn, X, and your blog. DOM-docx makes the document; Kompozy makes the content and ships it everywhere.
DOM-docx is an open-source (MIT) TypeScript library from floodtide that converts semantic HTML fragments into native, editable Word documents in the .docx (OOXML) format. It generates real paragraphs, lists, tables, and images rather than a screenshot, so the output opens as an editable Word file. It offers a CLI, a Node API, and an in-browser bundle.
No. DOM-docx is a deterministic HTML-to-Word converter, not an AI generator. It takes HTML you already have and turns it into a .docx file. To generate the content in the first place — a blog post, newsletter, or captions — you would use an AI content engine like Kompozy, then hand its HTML output to DOM-docx for the Word export.
For server-side use it needs Node.js 20 or newer, with a light core (docx, cheerio, and fflate). Playwright and Chromium are optional and only needed for the "computed" style mode or rasterizing complex graphics. The default inline style path and the browser bundle need no browser install.
As an early v0.1.x release it documents several limits: no external stylesheets on the inline path, no web fonts, no CSS grid or float layout, no forms, and no table rowspan. Complex SVG (paths, gradients) needs the rasterize option. Confirm the current feature set on the GitHub repo, since the project is moving quickly.
They sit at different points in the workflow. Kompozy generates on-brand content — blogs, newsletters, posts — and publishes it across nine platforms plus blog and email. DOM-docx converts the HTML of that content into an editable Word file for a downloadable lead magnet or client deliverable. Kompozy makes and distributes the content; DOM-docx exports the document.