6 months ago
862e38dThe in-app DOCX preview was flattening Word-specific structure into a generic Mammoth rendering, which made the live desktop view diverge sharply from the actual work document in Microsoft Word. This keeps Mammoth for text extraction but layers in a small DOCX layout-hints reader so the preview can recover the header artwork, footer text, accent colors, divider rule, and intro-block hierarchy from the OOXML package without adding another renderer dependency. Constraint: No new desktop dependency for DOCX rendering; reuse the existing mammoth bundle and renderer token system Rejected: Add a dedicated docx-preview dependency | violates the repo's no-new-dependency guidance for this fix Rejected: Shell out to Word or LibreOffice for every preview | too slow and platform-brittle for an interactive modal Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep DOCX chrome extraction preview-only and token-safe; if richer document fidelity is needed later, expand the preview parser deliberately instead of bypassing it with ad hoc shelling out Tested: bun run typecheck; bun run typecheck:desktop; cd apps/desktop && bun test; bun test; live Electron preview compared against Microsoft Word for the Intel Pro Day 2026 work doc Not-tested: DOCX files that store primary chrome outside header1/footer1 OOXML parts
Parent49a0ed2