highlightAst method

String highlightAst(
  1. MarkdownNode node,
  2. String source
)

Highlights source using the already parsed node AST.

Implementation

String highlightAst(MarkdownNode node, String source) {
  if (source.isEmpty) return '';
  final collector = _SpanCollector(source);
  node.accept(collector);
  return _renderSpans(source, collector.spans);
}