From 1f47a1729ea608640f59270765260b529698c04f Mon Sep 17 00:00:00 2001 From: Noah Hellman Date: Sat, 28 Jan 2023 16:38:19 +0100 Subject: [PATCH] parser: impl autolinks --- src/lib.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index 7292634..cb1e7f5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -457,7 +457,15 @@ impl<'s> Parser<'s> { 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(_)) { Event::Start(t, attributes)