Function parse_hyperlinks::parser::markdown::md_label2dest
source · pub fn md_label2dest(
i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>
Expand description
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,
optionally preceded by up to three spaces of indentation, followed by a
colon (:
), optional spaces or tabs (including up to one line
ending), a link
destination, optional
spaces or tabs (including up to one line
ending), and an optional
link title, which if it is
present must be separated from the link
destination by spaces
or tabs. No further character may occur.
A link reference definition does not correspond to a structural element of a document. Instead, it defines a label which can be used in reference links and reference-style images elsewhere in the document. Link reference definitions can come either before or after the links that use them.