Olov Lassus

Call for testing: Pygments Dart highlighter

22 Apr 2012

As mentioned before, the Dart highlighter lives in the upstream Pygments repository now and is included in releases since 1.5 (released Mar 10, 2012). I will try to keep it correct and updated.

Another milestone is that Github recently started using it! I found a few bugs just by clicking around in people’s repositories. The most obvious was keyword-detection on substrings, i.e. the String substring of StringBuffer got marked as a keyword. Another was failing to recognize escape characters inside string literals. Both are now fixed in my repo, so the example below renders fine.

main() {
  StringBuffer sb; // String isn't a keyword
  var integer; // nor is int
  var str = "Escapes \"just works\" now";
}

I need help with testing the highlighter to find bugs or missing features. I’m maintaining the Dart highlighter in my bitbucket repo. You can help by downloading it, trying it out on your own code and letting me know what works or not:

hg clone https://bitbucket.org/olov/pygments-main
cd pygments-main
./pygmentize -f html -o yourfile.html yourfile.dart

If you don’t have Mercurial (hg) installed then you can also click “get source” on bitbucket to download the source as a zip-file. Running pygmentize will create markup from your source code, which you then need to combine with a style sheet to get some color going. Feel free to copy my color scheme (syntax.css) if you like it. You can also run pygmentize yourfile.dart without -f and -o to get highlighted text directly on your console.

To install the development version of pygments system-wide just run sudo ./setup.py install.

File issues on bitbucket or fire a mail to the Dart misc thread or me directly. Even better, submit a pull request! :)

Show comments (Dart misc)


Follow me on Twitter

« Meteor meets NoGPL    ↑ Home     »