From 90d32279c3c0aaf2782c96491d57d4758a7c62f7 Mon Sep 17 00:00:00 2001 From: Victor Giers Date: Sat, 31 Jan 2026 16:42:55 +0100 Subject: [PATCH] Simplify and optimize line break handling in markdown.js --- src/markdown/markdown.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/markdown/markdown.js b/src/markdown/markdown.js index f8ca992..90a10d5 100644 --- a/src/markdown/markdown.js +++ b/src/markdown/markdown.js @@ -203,13 +203,9 @@ export function markdownToHTML(text) { } if (seenNonEmpty) { - if (emptyCount === 0) { + const breaksToAdd = Math.max(1, emptyCount); + for (let j = 0; j < breaksToAdd; j += 1) { htmlLines.push("
"); - } else { - const extraBreaks = Math.max(0, emptyCount - 1); - for (let j = 0; j < extraBreaks; j += 1) { - htmlLines.push("
"); - } } } else if (emptyCount > 0) { const extraBreaks = Math.max(0, emptyCount - 1);