Skip to main content

try_parse_reference_definition

Function try_parse_reference_definition 

Source
pub fn try_parse_reference_definition(
    text: &str,
    dialect: Dialect,
) -> Option<(usize, String, String, Option<String>)>
Expand description

Try to parse a reference definition starting at the current position. Returns Some((bytes_consumed, label, url, title)) on success.

text may span multiple lines. The destination and title may each be preceded by at most one newline (per CommonMark §4.7). Blank lines terminate the definition: callers should stop the input at the first blank line so the parser cannot cross one.

dialect controls a CommonMark-only constraint (§4.7): the title, if present on the same line as the destination, must be separated from the destination by at least one space or tab. Pandoc-markdown accepts the title even when it’s directly attached (e.g. [foo]: <bar>(baz)).

Syntax:

[label]: url "title"
[label]: <url> 'title'
[label]:
  url
  "title"