close method
Attempts to close this tag at the current position.
If a tag cannot be closed at the current position (for example, if a link
reference cannot be found for a link tag's label), then null is
returned.
If a tag can be closed at the current position, then this method calls
getChildren, in which parser parses any nested text into child nodes.
The returned Iterable includes these children nodes.
Implementation
@override
Iterable<Node>? close(
InlineParser parser,
covariant SimpleDelimiter opener,
Delimiter? closer, {
required List<Node> Function() getChildren,
String? tag,
}) {
final text = parser.source.substring(opener.endPos, parser.pos);
// The current character is the `]` that closed the span text.
// The next character must be a `{`:
parser.advanceBy(1);
if (parser.isDone) {
return null; // not valid syntax - skip
}
final char = parser.charAt(parser.pos);
if (char != _Chars.leftBrace) {
return null; // not valid syntax - skip
}
final attributes = _parseAttributes(parser) ?? {};
final node = _createNode(text, attributes, getChildren: getChildren);
return [node];
}