parse method

  1. @override
Node? parse(
  1. BlockParser parser
)
override

Implementation

@override
Node? parse(BlockParser parser) {
  final childLines = <String>[parser.current.content];

  parser.advance();
  var interruptedBySetextHeading = false;
  // Eat until we hit something that ends a paragraph.
  while (!parser.isDone) {
    final syntax = interruptedBy(parser);
    if (syntax != null) {
      interruptedBySetextHeading = syntax is SetextHeaderSyntax;
      break;
    }
    childLines.add(parser.current.content);
    parser.advance();
  }

  // It is not a paragraph, but a setext heading.
  if (interruptedBySetextHeading) {
    return null;
  }

  final contents = UnparsedContent(childLines.join('\n').trimRight());
  return Element('p', [contents]);
}