parse method

List<Node> parse()

Implementation

List<Node> parse() {
  while (!isDone) {
    // A right bracket (']') is special. Hitting this character triggers the
    // "look for link or image" procedure.
    // See https://spec.commonmark.org/0.29/#an-algorithm-for-parsing-nested-emphasis-and-links.
    if (charAt(pos) == $rbracket) {
      writeText();
      _linkOrImage();
      continue;
    }

    // See if the current text matches any defined markdown syntax.
    if (syntaxes.any((syntax) => syntax.tryMatch(this))) continue;

    // If we got here, it's just text.
    advanceBy(1);
  }

  // Write any trailing text content to a Text node.
  writeText();
  _processEmphasis(-1);
  _combineAdjacentText(_tree);
  return _tree;
}