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

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

Recognizes hyperlinks in Markdown, RestructuredText, Asciidoc or HTML format and returns the first hyperlink found as tuple: Some((link_text_or_label, link_destination, link_title)).

It returns None if no hyperlinks were found. See function take_text2dest_label2dest() for limitations.

use parse_hyperlinks::parser::first_hyperlink;
use std::borrow::Cow;

let i = "abc\n   [u]: v \"w\"\nabc";

let r = first_hyperlink(i);
assert_eq!(r, Some((Cow::from("u"), Cow::from("v"), Cow::from("w"))));