💄 add chapter titles to export
This commit is contained in:
@@ -307,9 +307,11 @@ export function registerIpcHandlers(): void {
|
|||||||
needsPageBreak = false
|
needsPageBreak = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const chapterTitle = doc.relativePath.split('/').pop() ?? doc.relativePath
|
||||||
|
const safeChapterTitle = chapterTitle.replace(/&/g, '&').replace(/</g, '<')
|
||||||
const contentHtml = await marked(normalize(doc.content))
|
const contentHtml = await marked(normalize(doc.content))
|
||||||
const cls = needsPageBreak ? 'page-break chapter' : 'chapter'
|
const cls = needsPageBreak ? 'page-break chapter' : 'chapter'
|
||||||
bodyHtml += `<div class="${cls}">${contentHtml}</div>`
|
bodyHtml += `<div class="${cls}"><h2>${safeChapterTitle}</h2>${contentHtml}</div>`
|
||||||
needsPageBreak = true
|
needsPageBreak = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user