Add DOCX and ODT export for the Full Book view

The main process now assembles the manuscript from the chapter files and
renders it to a Word document with the docx library, using the same
markdown-it plugin set as the on-screen renderer (highlight, callouts,
wikilinks). ODT is converted from that DOCX with LibreOffice running
headless, keeping the two formats consistent; a clear error is returned
when LibreOffice is missing. The Full Book header's single Export PDF
button becomes an Export menu (PDF/DOCX/ODT) wired to the File menu.

Tests: new run-office-export-test.mjs verifies DOCX/ODT structure,
chapter order and formatting; the e2e scenario exports through the real
IPC chain and checks magic bytes, extensions and the status notices.
This commit is contained in:
avi 2026-08-18 17:06:32 -05:00
commit 6679294231
12 changed files with 1403 additions and 15 deletions

View file

@ -15,7 +15,7 @@
"dev": "concurrently -k \"npm run build:watch\" \"wait-on dist/main.js && npm run electron\"",
"start": "npm run build && npm run electron",
"lint": "tsc --noEmit",
"test": "node tests/run-project-test.mjs && node tests/run-chapters-test.mjs && node tests/run-wikilinks-test.mjs && node tests/run-format-test.mjs",
"test": "node tests/run-project-test.mjs && node tests/run-chapters-test.mjs && node tests/run-wikilinks-test.mjs && node tests/run-format-test.mjs && node tests/run-office-export-test.mjs",
"package": "electron-builder",
"test:e2e": "sh tests/run-e2e.sh"
},
@ -26,6 +26,7 @@
"electron": "^32.0.0",
"electron-builder": "^26.15.3",
"esbuild": "^0.24.0",
"jszip": "^3.10.1",
"typescript": "^5.5.0",
"wait-on": "^8.0.0"
},
@ -38,6 +39,7 @@
"@codemirror/view": "^6.43.9",
"@lezer/highlight": "^1.2.3",
"archiver": "^8.0.0",
"docx": "^9.7.1",
"markdown-it": "^15.0.0"
}
}