fixup! parser: allow linebreak in text of link tag refs

This commit is contained in:
Noah Hellman 2023-01-28 16:38:17 +01:00
parent 6cf5aca1e3
commit 2e992f5726

View file

@ -441,9 +441,13 @@ impl<'s> Parser<'s> {
SpanLinkType::Inline, SpanLinkType::Inline,
), ),
inline::Container::ReferenceLink | inline::Container::ReferenceImage => { inline::Container::ReferenceLink | inline::Container::ReferenceImage => {
let tag = match self.inlines.src(inline.span) {
CowStr::Owned(s) => s.replace('\n', " ").into(),
s @ CowStr::Borrowed(_) => s,
};
let (url, attrs_def) = self let (url, attrs_def) = self
.link_definitions .link_definitions
.get(self.inlines.src(inline.span).replace('\n', " ").as_str()) .get(tag.as_ref())
.cloned() .cloned()
.unwrap_or_else(|| ("".into(), Attributes::new())); .unwrap_or_else(|| ("".into(), Attributes::new()));
attributes.union(attrs_def); attributes.union(attrs_def);