/** * Word Template Exporter * Loads word_template.docx, preserves first 2 pages (cover + TOC), * and adds markdown content starting from page 3 using template styles */ const fs = require('fs'); const path = require('path'); const PizZip = require('pizzip'); class WordTemplateExporter { constructor(templatePath, startPage = 3, pageSettings = null) { this.templatePath = templatePath || path.join(__dirname, '../word_template.docx'); this.startPage = startPage; // Which page to start inserting content this.pageSettings = pageSettings; // Page size and orientation settings } /** * Strip HTML artifacts that Pandoc / Word cannot render and that would * otherwise appear as visible text in DOCX output. * Removes HTML comments,