highlighter property

TextSpan Function(String code, String language)? highlighter
final

Custom syntax highlighter for fenced code blocks.

Receives the raw code text and the fence's info string (e.g. dart), and returns highlighted TextSpans. If null, code is rendered with PrismMarkdownStyle.codeStyle without highlighting.

PrismMarkdown(
  '```dart\nvoid main() {}\n```',
  highlighter: (code, language) => myHighlighter(code, language),
)

Implementation

final TextSpan Function(String code, String language)? highlighter;