Skip to main content

try_parse_inline_link

Function try_parse_inline_link 

Source
pub fn try_parse_inline_link(
    text: &str,
    strict_dest: bool,
) -> Option<(usize, &str, &str, Option<&str>)>
Expand description

Try to parse an inline link starting at the current position.

Inline links have the form [text](url) or [text](url "title"). Can also have trailing attributes: [text](url){#id .class}. Returns Some((length, text_content, dest_content, raw_attributes)) if a valid link is found.

strict_dest enables CommonMark ยง6.4 destination-and-title validation: the bare destination form may not contain spaces or ASCII control characters and must have balanced parentheses; if a title follows it must be properly delimited; only whitespace is allowed before/after. Pandoc-markdown is more permissive, so leave this off for that dialect.