Function parse_hyperlinks::parser::markdown::md_label2dest [−][src]
pub fn md_label2dest(
i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>
Matches a Markdown link reference definition.
The caller must guarantee, that the parser starts at first character of the input or at the first character of a line. The parser consumes all bytes until the end of the line.
use parse_hyperlinks::parser::Link; use parse_hyperlinks::parser::markdown::md_label2dest; use std::borrow::Cow; assert_eq!( md_label2dest(" [label]: <destination> 'title'\nabc"), Ok(("\nabc", (Cow::from("label"), Cow::from("destination"), Cow::from("title")))) );
CommonMark Spec: A link reference definition consists of a link
label, indented up to three spaces, followed by a colon (:), optional
whitespace (including up to one line ending), a link destination,
optional whitespace (including up to one line ending), and an
optional link title, which if it is present must be separated from the
link destination by whitespace. No further non-whitespace
characters may occur on the line.