[−][src]Function parse_hyperlinks::parser::first_hyperlink
pub fn first_hyperlink(
i: &str
) -> Option<(Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>
Searches for the first hyperlink or link reference definition in the input
text and returns the finding as a tuple:
Some((link_text_or_label, link_destination, link_title))
The function recognizes hyperlinks in Markdown, RestructuredText, Asciidoc or
HTML format. See function take_inline_or_ref_def_link()
for limitations.
use parse_hyperlinks::parser::first_hyperlink; use std::borrow::Cow; let i = "abc\n [u]: v \"w\"abc"; let r = first_hyperlink(i); assert_eq!(r, Some((Cow::from("u"), Cow::from("v"), Cow::from("w"))));