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

pub fn rst_link_text2dest(i: &str) -> IResult<&str, Link<'_>>

Parse a RestructuredText inline hyperlink.

The parser expects to start at the link start (`) to succeed. This parser always returns an empty link_title=Cow::Borrowed("").

use parse_hyperlinks::parser::Link;
use parse_hyperlinks::parser::restructured_text::rst_link_text2dest;
use std::borrow::Cow;

assert_eq!(
  rst_link_text2dest("`name <destination>`_abc"),
  Ok(("abc", Link::Text2Dest(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