parser: impl autolinks
This commit is contained in:
parent
2e992f5726
commit
1f47a1729e
1 changed files with 9 additions and 1 deletions
10
src/lib.rs
10
src/lib.rs
|
@ -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)
|
||||||
|
|
Loading…
Reference in a new issue