Skip to main content

try_parse_reference_link

Function try_parse_reference_link 

Source
pub fn try_parse_reference_link(
    text: &str,
    allow_shortcut: bool,
) -> Option<(usize, &str, String, bool)>
Expand description

Try to parse a reference link starting at the current position.

Reference links have three forms:

  • Explicit: [text][label]
  • Implicit: [text][] (label = text)
  • Shortcut: [text] (if shortcut_reference_links enabled)

Returns Some((length, text_content, label, is_shortcut)) if a valid reference link is found. The label is what should be looked up in the registry.