highlightSpans method
Highlights code and returns grapheme-aware decoration spans.
Spans use theme-independent style keys that can be resolved later through decorationStyles.
Implementation
List<SyntaxHighlightSpan> highlightSpans(String code, {String? language}) {
final nodes = _parseHighlightedNodes(code, language: language);
if (nodes == null || nodes.isEmpty) {
return const [];
}
return _nodesToSpans(nodes);
}