parseChildLines method
List<Line>
parseChildLines(
- BlockParser parser, [
- String openingMarker = '',
- int indent = 0
override
Implementation
@override
List<Line> parseChildLines(
BlockParser parser, [
String openingMarker = '',
int indent = 0,
]) {
final childLines = <Line>[];
parser.advance();
_FenceMatch? closingFence;
while (!parser.isDone) {
final match = pattern.firstMatch(parser.current.content);
closingFence = match == null ? null : _FenceMatch.fromMatch(match);
// Closing code fences cannot have info strings:
// https://spec.commonmark.org/0.30/#example-147
if (closingFence == null ||
!closingFence.marker.startsWith(openingMarker) ||
closingFence.hasInfo) {
childLines.add(
Line(_removeIndentation(parser.current.content, indent)),
);
parser.advance();
} else {
parser.advance();
break;
}
}
// https://spec.commonmark.org/0.30/#example-127
// https://spec.commonmark.org/0.30/#example-128
if (closingFence == null &&
childLines.isNotEmpty &&
childLines.last.isBlankLine) {
childLines.removeLast();
}
return childLines;
}