canParse method

  1. @override
bool canParse(
  1. BlockParser parser
)
override

Implementation

@override
bool canParse(BlockParser parser) {
  if (!_interperableAsParagraph(parser.current)) {
    return false;
  }

  var i = 1;
  while (true) {
    final nextLine = parser.peek(i);
    if (nextLine == null) {
      // We never reached an underline.
      return false;
    }
    if (_seTextPattern.hasMatch(nextLine)) {
      return true;
    }
    // Ensure that we're still in something like paragraph text.
    if (!_interperableAsParagraph(nextLine)) {
      return false;
    }
    i++;
  }
}