diff --git a/src/html.rs b/src/html.rs index 6a6fc59..a82b329 100644 --- a/src/html.rs +++ b/src/html.rs @@ -409,12 +409,20 @@ impl<'s, I: Iterator>, W: std::fmt::Write> Writer<'s, I, W> { Atom::Ellipsis => self.out.write_str("…")?, Atom::EnDash => self.out.write_str("–")?, Atom::EmDash => self.out.write_str("—")?, - Atom::ThematicBreak => self.out.write_str("\n
")?, Atom::NonBreakingSpace => self.out.write_str(" ")?, Atom::Hardbreak => self.out.write_str("
\n")?, Atom::Softbreak => self.out.write_char('\n')?, Atom::Escape | Atom::Blankline => unreachable!("filtered out"), }, + Event::ThematicBreak(attrs) => { + self.out.write_str("\n")?; + } } } if self.encountered_footnote { diff --git a/src/lib.rs b/src/lib.rs index 616d105..37001dd 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -26,6 +26,8 @@ pub enum Event<'s> { Str(CowStr<'s>), /// An atomic element. Atom(Atom<'s>), + /// A thematic break, typically a horizontal rule. + ThematicBreak(Attributes<'s>), } #[derive(Debug, PartialEq, Eq)] @@ -248,8 +250,6 @@ pub enum Atom<'s> { EnDash, /// An em dash. EmDash, - /// A thematic break, typically a horizontal rule. - ThematicBreak, /// A space that must not break a line. NonBreakingSpace, /// A newline that may or may not break a line in the output. @@ -674,7 +674,9 @@ impl<'s> Parser<'s> { let event = match ev.kind { tree::EventKind::Atom(a) => match a { block::Atom::Blankline => Event::Atom(Atom::Blankline), - block::Atom::ThematicBreak => Event::Atom(Atom::ThematicBreak), + block::Atom::ThematicBreak => { + Event::ThematicBreak(self.block_attributes.take()) + } block::Atom::Attributes => { self.block_attributes.parse(content); continue;