From 9fd10683c589da63005fa9e75e0298330dd317eb Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Sat, 28 Jan 2023 16:17:25 +0100 Subject: [PATCH] parser: throw away link-def/footnote attrs prevent attributes on link definitions and footnotes from applying to upcoming elements --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9db844a..c9fd290 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -532,6 +532,7 @@ impl<'s> Parser<'s> { if enter { self.tree.take_inlines().last(); } + attributes = Attributes::new(); continue; } if enter { @@ -569,6 +570,7 @@ impl<'s> Parser<'s> { block::Container::Footnote => { assert!(enter); self.footnotes.insert(content, self.tree.take_branch()); + attributes = Attributes::new(); continue; } block::Container::DescriptionList => Container::DescriptionList, @@ -935,7 +937,6 @@ mod test { "\n", "{a=b}\n", "[tag]: url\n", - "\n", "para\n", ), Start(Paragraph, Attributes::new()), @@ -947,7 +948,6 @@ mod test { End(Link("url".into(), LinkType::Span(SpanLinkType::Reference))), End(Paragraph), Atom(Blankline), - Atom(Blankline), Start(Paragraph, Attributes::new()), Str("para".into()), End(Paragraph),