[][src]Function parse_hyperlinks::parser::restructured_text::rst_link

pub fn rst_link(
    i: &str
) -> IResult<&str, (Cow<'_, str>, Cow<'_, str>, Cow<'_, str>)>

Parse a RestructuredText hyperlink. The parser expects to start at the link start (`) to succeed. It returns either Ok((i, (link_name, link_destination, link_title))) or some error. This parser always returns an empty link_title=Cow::Borrowed("").

use parse_hyperlinks::parser::restructured_text::rst_link;
use std::borrow::Cow;

assert_eq!(
  rst_link("`name <destination>`_abc"),
  Ok(("abc", (Cow::from("name"), Cow::from("destination"), Cow::from(""))))
);

A hyperlink reference may directly embed a destination URI or (since Docutils 0.11) a hyperlink reference within angle brackets <> as shown in the following example:

abc `Python home page <http://www.python.org>`_ abc

The bracketed URI must be preceded by whitespace and be the last text before the end string. For more details see the reStructuredText Markup Specification