highlight 0.3.0 highlight: ^0.3.0 copied to clipboard
Dart syntax highlighter with lots of languages and styles support. Zero dependencies, automatic language detection.
example/highlight_example.dart
import 'package:highlight/highlight.dart' as highlight;
main() {
var input = '''main() {
print("Hello, World!");
}
''';
// Parse input code and returns a highlight [Result] which contains relevance and tree nodes
var result = highlight.parse(input, language: 'dart');
// Output HTML string, which has highlight.js style class name, hljs-
var html = result.toHtml();
print(html);
}