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