From 7ecb6b8962ed8de4f92ce98a09ec4c96ab1b627d Mon Sep 17 00:00:00 2001 From: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> Date: Wed, 20 May 2026 18:00:13 +0000 Subject: [PATCH] feat: apply Noto Serif font and heading styles to DOCX export MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add document-level styles so the downloaded .docx has: - Noto Serif font throughout (matching the web UI) - Sized headings: H1 20pt, H2 16pt, H3 14pt, H4 12pt - 11pt body text with 1.15× line spacing - Consistent color (#1f1b16) and spacing - Styled hyperlinks (blue, underlined) - List paragraph font inheritance Co-Authored-By: alex --- src/markdownToDocx.js | 76 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) diff --git a/src/markdownToDocx.js b/src/markdownToDocx.js index b2db4dc..f4b5aad 100644 --- a/src/markdownToDocx.js +++ b/src/markdownToDocx.js @@ -197,6 +197,82 @@ export function markdownToDocx(markdown, title) { return new Document({ title: title || 'PMC Funding Brief', + styles: { + default: { + document: { + run: { + font: 'Noto Serif', + size: 22, // 11 pt + color: '1f1b16', + }, + paragraph: { + spacing: { after: 160, line: 276 }, // 1.15× line spacing + }, + }, + heading1: { + run: { + font: 'Noto Serif', + size: 40, // 20 pt + bold: true, + color: '1f1b16', + }, + paragraph: { + spacing: { before: 360, after: 120 }, + }, + }, + heading2: { + run: { + font: 'Noto Serif', + size: 32, // 16 pt + bold: true, + color: '1f1b16', + }, + paragraph: { + spacing: { before: 300, after: 120 }, + }, + }, + heading3: { + run: { + font: 'Noto Serif', + size: 28, // 14 pt + bold: true, + color: '1f1b16', + }, + paragraph: { + spacing: { before: 240, after: 80 }, + }, + }, + heading4: { + run: { + font: 'Noto Serif', + size: 24, // 12 pt + bold: true, + color: '1f1b16', + }, + paragraph: { + spacing: { before: 200, after: 80 }, + }, + }, + listParagraph: { + run: { + font: 'Noto Serif', + size: 22, + }, + }, + }, + paragraphStyles: [ + { + id: 'Hyperlink', + name: 'Hyperlink', + run: { + color: '1d4ed8', + underline: { type: 'single' }, + font: 'Noto Serif', + size: 22, + }, + }, + ], + }, numbering: { config: [ {