highLightSpans function

List<InlineSpan> highLightSpans(
  1. String input, {
  2. String? language,
  3. bool autoDetectionLanguage = false,
  4. Map<String, TextStyle> theme = const {},
  5. TextStyle? textStyle,
  6. TextStyle? styleNotMatched,
  7. int tabSize = 8,
})

transform code to highlight code

Implementation

List<InlineSpan> highLightSpans(
  String input, {
  String? language,
  bool autoDetectionLanguage = false,
  Map<String, TextStyle> theme = const {},
  TextStyle? textStyle,
  TextStyle? styleNotMatched,
  int tabSize = 8,
}) {
  return convertHiNodes(
      hi.highlight
          .parse(input.trimRight(),
              language: autoDetectionLanguage ? null : language,
              autoDetection: autoDetectionLanguage)
          .nodes!,
      theme,
      textStyle,
      styleNotMatched);
}