highlight method
Returns the spans for code, tagged for language. Implementations must
preserve text exactly: the concatenation of the returned spans' text must
equal code, so selection and copy stay aligned. baseStyle is the code
block's base (monospace) style, already applied to the enclosing span.
Implementation
@override
List<InlineSpan> highlight(
String code,
String? language,
TextStyle baseStyle,
) {
final grammar =
language == null ? null : _languages[language.toLowerCase()];
if (grammar == null) return <InlineSpan>[TextSpan(text: code)];
return _spansFor(_tokenize(code, grammar), theme);
}