compose: Remove extra blank line before lists.

Previously, inserting a bulleted or numbered list via the compose
box added an extra blank line before and after the list.

This commit removes the extra blank line inserted before the list.

Fixes #32607.
This commit is contained in:
Aditya Kumar Kasaudhan
2025-01-01 15:56:02 +05:30
committed by Tim Abbott
parent c44c153b9a
commit 79be013882
2 changed files with 7 additions and 7 deletions

View File

@@ -658,14 +658,10 @@ export let format_text = (
.split("\n")
.map((line, i) => mark(line, i))
.join("\n");
// We always ensure a blank line before and after the list, as we want
// We always ensure a blank line after the list, as we want
// a clean separation between the list and the rest of the text, especially
// when the markdown is rendered.
// Add blank line between text before and list if not already present.
if (before_lines.length > 0 && before_lines.at(-1) !== "\n") {
before_lines += "\n";
}
// Add blank line between list and rest of text if not already present.
if (after_lines.length > 0 && after_lines.at(0) !== "\n") {
after_lines = "\n" + after_lines;