frontpage.
newsnewestaskshowjobs

Open Source @Github

fp.

Open in hackernews

Show HN: DOM-docx – HTML to native, editable Word docs (MIT)

https://github.com/floodtide/dom-docx
30•fishbone•1h ago

Comments

fishbone•1h ago
Hey HN, author here.

I do a lot of backend document (docx file) generation work, and updating our templates and backend code is one of my least favorite development tasks. Cryptic errors, minute-plus rebuild loops. I’d much prefer building these reports in JS rendered HTML (e.g., Vue or React), but existing HTML-to-docx libraries in the OSS ecosystem don't produce output that's actually valid, editable Word structure.

I'd had good luck applying Karpathy's Autoresearch pattern (agent runs iterations against an objective score, keeps what improves, discards what doesn't) to a couple of other problems, and figured OOXML fidelity was a good fit.

The Autoresearch process goes like this: render HTML and take a screenshot, use dom-docx to convert to docx, rasterize the docx file with LibreOffice and take another screenshot, score the browser HTML screenshot vs LibreOffice screenshot and measure layout fidelity + editability + speed as a quality metric, feed score back in, and repeat to drive higher fidelity within the constraints of editability and performance. It’s a beautiful thing to watch.

Burned some tokens and ran that loop against 37 real-world HTML patterns such as nested lists, tables, flex layouts and blockquotes (stuff that often breaks converters) and "brute forced" my way to what I hope is a high-fidelity HTML to docx converter.

A few things about where it landed:

- Native OOXML output, real Word structure, not a screenshot or a 1x1 table pretending to be a document - Works in Node, in the browser (no Playwright needed for the default path), and as a CLI (npx dom-docx input.html -o output.docx) - MIT licensed - Full benchmark methodology + results vs the established OSS alternatives: https://github.com/floodtide/dom-docx/blob/main/docs/BENCHMA...

Live demo if you want to test HTML conversion in the browser: https://dom-docx.com

Happy to answer anything about the scoring loop or anything else.

PS: This is the first thing I've open sourced and I'm excited to see where it leads!

Octoth0rpe•1h ago
That's an interesting approach. I'm concerned about the use of LibreOffice as your source of truth. Would it be possible to swap out LibreOffice for actual MS Word in this workflow? This also could reveal some libreoffice rendering bugs/edge cases that are worth filing bugs over.
fishbone•49m ago
I don’t have MS word installed on my development machine, so I haven’t done much testing with Word, but that does sound like a good idea to run the suite using Word. For what it’s worth I did not notice any issues with LibreOffice, even after running many iterations and tests.
m_w_•13m ago
I would add a +1 for testing w/ Word - the official Office suite runs some validation where only Word will show a "broken file" popup, even when nothing else does.

In our case, clients use only real Word, so any machine-generated/mutated files (excel/ppt as well) need a pass through the real office executable.

fishbone•4m ago
Thanks for the feedback, I’ll add Word validation to my todo list.
noufalibrahim•1h ago
Surely I can't be the only one who misread the heading and clicked expecting to see DOOM implemented using just HTML DOM. :-/
_fzslm•38m ago
For that you probably want this, lol: https://cssdoom.wtf/
alansaber•33m ago
Pretty sure that has been done. I clicked to see DOOM implemented using OOXML.
virajk_31•35m ago
I have done something similar for PPTX, keeping the fidility intact was really challenging with computed values & OOXML counterparts and again challanges with different XML implementations like that of MS & Libre..
fishbone•28m ago
Agreed, visual fidelity is pretty hard, and that’s why none of the scores are 100.
ape4•17m ago
Just adding, since I don't see it mentioned in the readme, that its written in Typescript. That's what makes this interesting. I imagine Pandoc can do this but its not Typescript (its Haskell).
jkwang•6m ago
The screenshot-to-docx scoring loop is a clever way to verify layout fidelity. Very useful for anyone generating reports from HTML.

Show HN: DOM-docx – HTML to native, editable Word docs (MIT)

https://github.com/floodtide/dom-docx
30•fishbone•1h ago•12 comments

Show HN: A Sims-style house builder in the browser (Three.js, no back end)

https://github.com/ch-bas/threejs-sims-house-builder
4•ch-bas•54m ago•1 comments

Show HN: Loot Raiders – an ARC Raiders-inspired inventory game in Svelte

https://loot-raiders.vercel.app
6•refrigerator-12•6h ago•1 comments

Show HN: Mindwalk – Replay coding-agent sessions on a 3D map of your codebase

https://github.com/cosmtrek/mindwalk
157•cosmtrek•1d ago•63 comments

Show HN: Codebase Posters – turn any Git repo into generative poster art

https://github.com/unable12/codebase-posters
24•unable0•15h ago•5 comments

Show HN: Getting GLM 5.2 running on my slow computer

https://github.com/JustVugg/colibri
920•vforno•4d ago•232 comments

Show HN: Pentaton LP – a music streamer with an LP sleeve sized display

https://pentaton.app/blog/2026-07-12-introducing-pentaton-lp/
4•interfeco•5h ago•0 comments

Show HN: Zen Mode – a global focus mode for macOS

https://github.com/cabeen/zen-mode
26•cafebeen•16h ago•10 comments

Show HN: Shirei, cross-platform GUI framework in native Go

https://github.com/hasenj/go-shirei/
86•hsn915•20h ago•53 comments

Show HN: 18 Words

https://18words.com/
1150•pompomsheep•4d ago•360 comments

Show HN: Kurvengefahr – browser CAD/CAM for pen plotters

https://kurvengefahr.org/
20•tibordp•23h ago•6 comments

Show HN: Level – a new demo for 8bit Atari XL/XE

https://ilmenit.github.io/level-by-agenda/
4•ilmenit•7h ago•0 comments

Show HN: Skillscript – A declarative, sandboxed language for tool orchestration

https://github.com/sshwarts/skillscript
16•sshwarts•1d ago•21 comments

Show HN: Learn by rebuilding Redis, Git, a database from scratch

https://shipthatcode.com
193•acley•1d ago•65 comments

Show HN: Ant – A JavaScript runtime and ecosystem

https://antjs.org
322•theMackabu•1d ago•147 comments

Show HN: Orbit – AR satellite tracker, watch 15k+ objects

https://nagylukas.github.io/orbit.html
85•lukas9•1d ago•19 comments

Show HN: Capn-hook for coding agents – don't grep the same mystery twice

https://github.com/cyrusNuevoDia/capn-hook
8•knrz•16h ago•1 comments

Show HN: Agent-run – Run a coding agent in a sandboxed environment

https://github.com/sin-ack/agent-run
7•trashburger•16h ago•2 comments

Show HN: Sqlsure – deterministic semantic checks for AI-generated SQL

https://github.com/sqlsure/sqlsure
41•tejusarora•1d ago•7 comments

Show HN: Hologram, photo management and culling built with Tauri

https://github.com/ThatXliner/Hologram
3•thatxliner•14h ago•0 comments

Show HN: Earth Game – An offline CLI for turning life goals into quests

https://github.com/skorotkiewicz/earth-game
54•modinfo•1d ago•12 comments

Show HN: Cpulse – See why your Docker Compose stack is stuck

https://github.com/hyturing/compose-pulse
3•hyturing•14h ago•0 comments

Show HN: Reverse-engineering web apps into agent tools

94•pancomplex•3d ago•39 comments

Show HN: Self-hosted voice AI agent for Asterisk/FreePBX

https://github.com/hkjarral/AVA-AI-Voice-Agent-for-Asterisk
5•hkjarral•10h ago•1 comments

Show HN: Web App Uses RTL-SDR to Align HDTV Antenna

https://tunerscope.com/
3•robotastic•11h ago•0 comments

Show HN: PitchTrail – Perfect Pitch for Kids

https://pitchtrail.app/
6•theckel•16h ago•3 comments

Show HN: Free Community Radio Player (PWA)

https://radiodock.app/
4•bitmancer•16h ago•0 comments

Show HN: Reame – a CPU inference server that gets faster as it runs

https://github.com/swellweb/reame
56•targetbridge•1d ago•18 comments

Show HN: Wyrm – Solve algebra by touch, built on an open-source soundness engine

https://github.com/dicroce/wyrm_math
81•dicroce•4d ago•24 comments

Show HN: Let your coding agent iterate by seeing the browser

https://github.com/puffinsoft/peek-cli
6•G3819•13h ago•0 comments