Simplify and optimize line break handling in markdown.js

This commit is contained in:
2026-01-31 16:42:55 +01:00
parent 15993ed33c
commit 90d32279c3

View File

@@ -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("<br />");
} else {
const extraBreaks = Math.max(0, emptyCount - 1);
for (let j = 0; j < extraBreaks; j += 1) {
htmlLines.push("<br />");
}
}
} else if (emptyCount > 0) {
const extraBreaks = Math.max(0, emptyCount - 1);