html: fix initial newline when hr first element

This commit is contained in:
Noah Hellman 2023-04-29 14:11:01 +02:00
parent 9bbfb5ed75
commit d2a46663f1

View file

@ -392,7 +392,10 @@ impl<'s> Writer<'s> {
Event::Softbreak => out.write_char('\n')?,
Event::Escape | Event::Blankline => {}
Event::ThematicBreak(attrs) => {
out.write_str("\n<hr")?;
if self.not_first_line {
out.write_char('\n')?;
}
out.write_str("<hr")?;
for (a, v) in attrs.iter() {
write!(out, r#" {}=""#, a)?;
v.parts().try_for_each(|part| write_attr(part, &mut out))?;