Source code is available at https://gist.github.com/1320163. Install it by appending the gist to Pygments’s agile.py
and add the following line to _mapping.py
.
'DartLexer': ('pygments.lexers.agile', 'Dart', ('dart'), ('*.dart',), ('text/x-dart')),
Then run pygmentize -f html -o yourfile.html yourfile.dart
to generate markup from your source code. You’ll need to combine it with a style sheet. Feel free to copy my color scheme (syntax.css) if you like it.
Dart syntax highlighting example:
// Greeter example from
// <http://www.dartlang.org/docs/getting-started/interface.html>
class Greeter implements Comparable {
String prefix = 'Hello,';
Greeter() {}
Greeter.withPrefix(this.prefix);
greet(String name) => print('$prefix $name');
int compareTo(Greeter other) => prefix.compareTo(other.prefix);
}
void main() {
Greeter greeter = new Greeter();
Greeter greeter2 = new Greeter.withPrefix('Hi,');
num result = greeter2.compareTo(greeter);
if (result == 0) {
greeter2.greet('you are the same.');
} else {
greeter2.greet('you are different.');
}
}
Follow me on Twitter
« Describing Live programming (again) ↑ Home Let's create us some Dart ranges »