pub fn find_first(i: &str) -> Option<Link<'_>>
Expand description
Recognizes hyperlinks in all supported markup languages
and returns the first hyperlink found as
Some(Link::Text2Dest
or Some(Link::Image2Dest)
.
Returns None
if no hyperlink is found.
This function resolves link references.
use parse_hyperlinks::parser::Link;
use parse_hyperlinks::iterator::find_first;
use std::borrow::Cow;
let i = r#"abc[t][u]abc
[u]: v "w"
abc"#;
let r = find_first(i);
assert_eq!(r, Some(Link::Text2Dest(Cow::from("t"), Cow::from("v"), Cow::from("w"))));