From 9fdd402d079e343a80a94fe0025363321145843a Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Sat, 28 Jan 2023 15:38:15 +0100 Subject: [PATCH] parser: allow linebreak in text of link tag refs e.g. [my link][] will link to [my link]: url --- src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 147bf92..c4d77b0 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -435,14 +435,14 @@ impl<'s> Parser<'s> { ), inline::Container::ReferenceLink => Container::Link( self.link_definitions - .get(self.inlines.src(inline.span).as_ref()) + .get(self.inlines.src(inline.span).replace('\n', " ").as_str()) .cloned() .unwrap_or_else(|| "".into()), LinkType::Span(SpanLinkType::Reference), ), inline::Container::ReferenceImage => Container::Image( self.link_definitions - .get(self.inlines.src(inline.span).as_ref()) + .get(self.inlines.src(inline.span).replace('\n', " ").as_str()) .cloned() .unwrap_or_else(|| "".into()), SpanLinkType::Reference,