highlighting 0.9.0+11.8.0 copy "highlighting: ^0.9.0+11.8.0" to clipboard
highlighting: ^0.9.0+11.8.0 copied to clipboard

Syntax highlighting for Dart with lots of languages and themes support.

highlighting #

Code syntax highlighting library for over 190 languages.

If you are looking for the Flutter widget, see flutter_highlighting.

This package is a port of HighlightJS project into Dart. It is periodically updated from the original JavaScript version with an automated script.

Usage #

import 'package:highlighting/highlighting.dart';
import 'package:highlighting/languages/dart.dart';

void main() {
  final source = '''main() {
  print('Highlighting by Akvelon.');
}
''';

  highlight.registerLanguage(dart);

  final highlighted = highlight.parse(source, languageId: dart.id);
  final html = highlighted.toHtml();
  print(html); // HTML string
}

Versions and Migration #

The package uses its own version numbering in addition to that of HighlightJS. For example, the version 0.9.0+11.8.0 means that it is:

  • Version 0.9.0 of the Dart package itself, and it contains breaking changes over the version 0.8.x.
  • Ported from HighlightJS version 11.8.0.

This allows the pub tool to automatically guard you against breaking changes.

Migration guides:

Maintainer's Guide #

References #

3
likes
110
pub points
77%
popularity

Publisher

verified publisherakvelon.com

Syntax highlighting for Dart with lots of languages and themes support.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

collection, equatable, meta, tuple

More

Packages that depend on highlighting