highlight 0.2.0 copy "highlight: ^0.2.0" to clipboard
highlight: ^0.2.0 copied to clipboard

outdated

Dart syntax highlighter with lots of languages and styles support. Zero dependencies, automatic language detection.

highlight #

Syntax highlighter for Dart developers.

If you are looking for syntax highlight widget for Flutter, see flutter_highlight.

Usage #

import 'package:highlight/highlight.dart' show Highlight;

main() {
  var input = '''main() {
  print("Hello, World!");
}
''';

  // Create a syntax highlight instance
  var hl = Highlight();

  // Parse input code and returns a highlight [Result] which contains relevance and tree nodes
  var result = hl.parse(input, language: 'dart');

  // Output HTML string, which has highlight.js style class name, hljs-
  var html = result.toHtml();
  print(html);
}

References #

License #

MIT

47
likes
0
pub points
95%
popularity

Publisher

unverified uploader

Dart syntax highlighter with lots of languages and styles support. Zero dependencies, automatic language detection.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

More

Packages that depend on highlight