// AI TOOLS · DOM-DOCX

DOM-docx

An open-source library that converts semantic HTML into native, fully editable Word documents — real paragraphs, lists, tables, and images, not a screenshot.

KompozyTurn one idea into a week of content — across every platform, published for you.
Get Started →

Last verified · 2026-07-13 · by Moe Ameen

What DOM-docx is

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.

What you can make with it

  • Editable Word (.docx) files from HTML fragments — real paragraphs, headings, lists, and tables, not an image
  • Client-ready deliverables: reports, proposals, and one-pagers exported from a web template
  • Downloadable lead magnets (guides, checklists, whitepapers) generated as Word docs
  • Formatted documents with a cover page, headers/footers, page numbers, and a table of contents
  • Documents with embedded images, links, and simple charts (SVG bars, or rasterized complex graphics)
  • Batch conversions in a build pipeline via the CLI, Node API, or in-browser bundle

How Kompozy turns DOM-docx output into content

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.

  1. Generate the source in Kompozy — a Blog Article or Email Newsletter drafted in your brand voice via the Persona Brief.
  2. Export that content as HTML and run it through DOM-docx (CLI, Node, or the browser bundle) to produce an editable Word file.
  3. Use the .docx as a downloadable lead magnet, a client deliverable, or an internal draft your team edits.
  4. Back in Kompozy, fan the same idea into a carousel, quote cards, native text posts, and a short video.
  5. Schedule and publish the whole set across TikTok, Reels, Shorts, LinkedIn, X, and your blog from one queue.

Frequently asked questions

What is DOM-docx?

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.

Does DOM-docx use AI?

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.

What do I need to run DOM-docx?

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.

What are DOM-docx's limitations?

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.

How does DOM-docx fit with Kompozy?

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.

Related tools

  • WordgardA new open-source, in-browser rich-text editor library from the creator of ProseMirror and CodeMirror — a foundation developers build writing surfaces on.
  • OfficeCLIAn open-source, single-binary Office suite built for AI agents — it lets an agent read, edit, and automate Word, Excel, and PowerPoint files without any Office install.
  • FFmpeg's New AAC EncoderFFmpeg's rewritten native AAC audio encoder — cleaner audio at the same bitrate, free and built in, no external library.

← All AI tools · Get started →