feat: apply Noto Serif font and heading styles to DOCX export
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 <alex@semipublic.co>
This commit is contained in:
@@ -197,6 +197,82 @@ export function markdownToDocx(markdown, title) {
|
|||||||
|
|
||||||
return new Document({
|
return new Document({
|
||||||
title: title || 'PMC Funding Brief',
|
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: {
|
numbering: {
|
||||||
config: [
|
config: [
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user