diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-25 11:15:27 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-25 11:15:27 +0200 |
| commit | e217e826ce2129aa64a762546f9bbe7b9d356cc9 (patch) | |
| tree | 5f99fb5b8489cbdbbcf52874d8d6976527100c61 | |
| parent | 802d57c2c69aa4a6b21f3199fe08a806ce6aca11 (diff) | |
Render plot summaries with proper paragraph breaks
- Split summary text by double newlines into separate <p> tags
- Rename section header from "Summary" to "Plot"
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
| -rw-r--r-- | js/app.js | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -198,17 +198,19 @@ function openModal(bookId) { // Get summary from book data (embedded by build.js) const summary = book.summary; - // Build summary section + // Build summary section - split into paragraphs let summaryHtml; if (summary) { + const paragraphs = summary.split(/\n\n+/).filter(p => p.trim()); + const paragraphsHtml = paragraphs.map(p => `<p>${escapeHtml(p)}</p>`).join('\n'); summaryHtml = ` - <h3>Summary</h3> - <p>${escapeHtml(summary)}</p> + <h3>Plot</h3> + ${paragraphsHtml} `; } else { summaryHtml = ` - <h3>Summary</h3> - <p class="no-summary">No summary available for this book.</p> + <h3>Plot</h3> + <p class="no-summary">No plot summary available for this book.</p> `; } |
