Skip to content

Commit 554e5a7

Browse files
committed
fix: ensure empty lines in markdown codeblocks are displayed
1 parent fd57b4b commit 554e5a7

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

client/src/routes/internal/highlight/+server.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,10 @@ const highlight = async (
8181
for (const token of line) {
8282
lineHtml += `<span style="color: ${token.variants.dark.color}">${he.encode(token.content)}</span>`;
8383
}
84+
// ensure empty lines are rendered
85+
if (line.length === 0) {
86+
lineHtml += `\n`;
87+
}
8488
lineHtml += `</span>`;
8589
result += lineHtml;
8690
}

0 commit comments

Comments
 (0)