parser: impl autolinks

This commit is contained in:
Noah Hellman 2023-01-28 16:38:19 +01:00
parent 2e992f5726
commit 1f47a1729e

View file

@ -457,7 +457,15 @@ impl<'s> Parser<'s> {
Container::Image(url, SpanLinkType::Reference) Container::Image(url, SpanLinkType::Reference)
} }
} }
inline::Container::Autolink => todo!("{:?}", c), inline::Container::Autolink => {
let url = self.inlines.src(inline.span);
let url = if url.contains('@') {
format!("mailto:{}", url).into()
} else {
url
};
Container::Link(url, LinkType::AutoLink)
}
}; };
if matches!(inline.kind, inline::EventKind::Enter(_)) { if matches!(inline.kind, inline::EventKind::Enter(_)) {
Event::Start(t, attributes) Event::Start(t, attributes)