parse method

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

Implementation

@override
md.Node parse(md.BlockParser parser) {
  final type = _alert.firstMatch(parser.current.content)![1]!.toLowerCase();
  final lines = parseChildLines(parser).skip(1).toList();
  final children = md.BlockParser(
    lines,
    parser.document,
  ).parseLines(parentSyntax: this);
  return md.Element('div', [
    md.Element('p', [md.Text(_titles[type]!)])
      ..attributes['class'] = 'markdown-alert-title',
    ...children,
  ])..attributes['class'] = 'markdown-alert markdown-alert-$type';
}