Fix replace in block quote formatting

This commit is contained in:
Thomas Gideon 2023-07-24 17:48:29 -04:00
parent 9771d05c44
commit 6bc62f52cd

View file

@ -94,7 +94,7 @@ fn apply_block_quote<S: AsRef<str>>(depth: usize, content: S) -> String {
let content = content.replace("<p>", "");
let content = content.replace("</p>", "");
// replace separately to avoid trailing spaces when replacing empty lines with the prefix
let content = empty.replace(content.as_ref(), format!("\n{}\n", prefix));
let content = empty.replace_all(content.as_ref(), format!("\n{}\n", prefix));
let content = non_empty.replace_all(&content, |c: &Captures| {
format!("\n{} {}", prefix, c["initial"].to_string())
});