parse method
Node
parse(
- BlockParser parser
)
Implementation
@override
md.Node parse(md.BlockParser parser) {
final closer = mathBlockCloserFor(
pattern.firstMatch(parser.current.content)![1]!,
);
parser.advance();
final lines = <String>[];
var closed = false;
while (!parser.isDone) {
final line = parser.current.content;
parser.advance();
if (closer.hasMatch(line)) {
closed = true;
break;
}
lines.add(line);
}
// An unclosed block is still arriving; it is shown as source until the
// closing line comes in.
return md.Element.text(blockMathTag, lines.join('\n').trim())
..attributes['closed'] = '$closed';
}