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}