parser: allow linebreak in text of link tag refs

e.g.

    [my
    link][]

will link to

    [my link]: url
This commit is contained in:
Noah Hellman 2023-01-28 15:38:15 +01:00
parent 8b8ccd65bb
commit 9fdd402d07

View file

@ -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,