From 26c4e8a90c51d7b2cc58c0290848274573d8d863 Mon Sep 17 00:00:00 2001 From: Alex Hernandez Date: Wed, 27 May 2026 18:34:20 +1000 Subject: [PATCH] :lipstick: show novel title in single chapter export PDF --- src/main/ipcHandlers.ts | 36 ++++++++++++++++++++++++++++-------- tsconfig.node.tsbuildinfo | 2 +- 2 files changed, 29 insertions(+), 9 deletions(-) diff --git a/src/main/ipcHandlers.ts b/src/main/ipcHandlers.ts index 8456364..9f46122 100644 --- a/src/main/ipcHandlers.ts +++ b/src/main/ipcHandlers.ts @@ -192,13 +192,14 @@ export function registerIpcHandlers(): void { if (result.canceled || !result.filePath) return const { marked } = await import('marked') + const { PDFDocument, rgb, StandardFonts } = await import('pdf-lib') // Draft files use single \n between paragraphs; marked needs \n\n to create

elements const normalized = content.replace(/\r\n/g, '\n').replace(/\n(?!\n)/g, '\n\n') const bodyHtml = await marked(normalized) - // Escape for safe injection into HTML attributes const safeTitle = fileName.replace(/&/g, '&').replace(/"/g, '"').replace(//g, '>') + const projectTitle = getProjectTitle().toUpperCase() + const chapterTitle = fileName.toUpperCase() const html = ` @@ -206,7 +207,7 @@ export function registerIpcHandlers(): void { ${safeTitle}