parse method

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

Implementation

@override
Node? parse(BlockParser parser) {
  final current = parser.current.content;
  final pos = parser.pos + parser.offset;
  final match = pattern.firstMatch(current)!;
  final label = match[2]!;
  final refs = parser.document.footnoteReferences;
  refs[label] = 0;

  final id = Uri.encodeComponent(label);
  parser.advance();
  final lines = [
    Line(current.substring(match[0]!.length)),
    ...parseChildLines(parser),
  ];
  final children = parser.document.getBlockParser(lines,
      offset: pos).parseLines();
  return Element('li', children)
    ..attributes['id'] = 'fn-$id'
    ..footnoteLabel = label;
}