pub fn parse_link_reference_definitions(offset: usize, text: &str) -> Result<Vec<LinkReference>, ParseError> {
  let mut char_scanner = CharScanner::new(offset, text);
  let mut references = Vec::new();

  while let Some((byte_pos, c)) = char_scanner.next() {
    // Could encounter a `>` at the start of a line when checking
    // markdown nodes within a block quote, so skip over any `>` chars.
    if c.is_whitespace() || c == '>' {
      continue;
    } else if c == '[' {
      let link_ref_definition = parse_link_reference_definition(byte_pos, &mut char_scanner)?;
      references.push(link_ref_definition);
    } else {
      return Err(ParseError::new(
        Range {
          start: byte_pos,
          end: byte_pos + c.len_utf8(),
        },
        &format!("Unexpected token `{}` while parsing link reference definition.", c),
      ));
    }
  }

  return Ok(references);
}
/// Crudely parses out link reference definitions from the provided text.
Crudely parses out link reference definitions from the provided text.
Crudely parses out link reference definitions from the provided text .
pub fn parse_link_reference_definitions(offset: usize, text: &str) -> Result<Vec<LinkReference>, ParseError> {
  let mut char_scanner = CharScanner::new(offset, text);
  let mut references = Vec::new();
  while let Some((byte_pos, c)) = char_scanner.next() {
    // Could encounter a `>` at the start of a line when checking
    // markdown nodes within a block quote, so skip over any `>` chars.
    if c.is_whitespace() || c == '>' {
      continue;
    } else if c == '[' {
      let link_ref_definition = parse_link_reference_definition(byte_pos, &mut char_scanner)?;
      references.push(link_ref_definition);
    } else {
      return Err(ParseError::new(
        Range {
          start: byte_pos,
          end: byte_pos + c.len_utf8(),
        },
        &format!("Unexpected token `{}` while parsing link reference definition.", c),
      ));
    }
  }
  return Ok(references);
}
pub fn parse_link_reference_definitions ( offset : usize , text : & str ) -> Result < Vec < LinkReference > , ParseError > { let mut char_scanner = CharScanner :: new ( offset , text ) ; let mut references = Vec :: new ( ) ; while let Some ( ( byte_pos , c ) ) = char_scanner . next ( ) { // Could encounter a `>` at the start of a line when checking // markdown nodes within a block quote, so skip over any `>` chars. if c . is_whitespace ( ) || c == '>' { continue ; } else if c == '[' { let link_ref_definition = parse_link_reference_definition ( byte_pos , & mut char_scanner ) ? ; references . push ( link_ref_definition ) ; } else { return Err ( ParseError :: new ( Range { start : byte_pos , end : byte_pos + c . len_utf8 ( ) , } , & format ! ( " " c ) , ) ) ; } } return Ok ( references ) ; }
Crudely parses out link reference definitions from the provided text.
Crudely parses out link reference definitions from the provided text .
offset
usize
text
&str
offset
usize
text
&str