onMatch method

  1. @override
bool onMatch(
  1. InlineParser parser,
  2. Match match
)
override

Processes match, adding nodes to parser and possibly advancing parser.

Returns whether the caller should advance parser by match[0].length.

Implementation

@override
bool onMatch(InlineParser parser, Match match) {
  final chars = match.match;

  String text;
  if ('&"<>'.contains(match[1]!) && parser.encodeHtml) {
    text = escapeHtml(match[1]!);
  } else {
    text = chars[1];
  }

  parser.addNode(Text(text));
  return true;
}