[][src]Function parse_hyperlinks::parser::first_hyperlink

pub fn first_hyperlink(
    i: &str
) -> Option<(Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>

Searches for hyperlinks in the input text and returns the first finding as tuple: Some((link_name, link_destination, link_title)) The function recognizes hyperlinks in Markdown, RestructuredText or HTML format. See function take_hyperlink() 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"))));