Rainbow.js - code syntax highlighting in 1.2kb
craig.is
craig.is
I can't see the license specified anywhere, any chance you could add a LICENSE file or similar?
My guess: File size (in a brief check, Rainbow appears to be about half the size, unpacked), active development, and use of github (code-prettify is a few years old, hosted via SVN on Google code, and updated infrequently.)
However, prettify has a much broader range of languages already available for use.
https://github.com/ccampbell/rainbow/blob/master/js/rainbow....
Rainbow["onHighlight"] = Rainbow.onHighlight;
Isn't that line useless since `obj['property'] == obj.property` is always true?https://github.com/ccampbell/rainbow/blob/master/js/rainbow....
In order to preserve the methods and keep them public you have to reference them like this.
Thanks!
That is why the syntax in Rainbow is pretty similar.
The main problem had to do with Javascript regex not fully supporting everything that most languages support such as negative/positive lookbehinds and (.*)
1. TM syntaxes are complicated. There's lots of undocumented features that bundles find ways to use in crucial places.
2. TM is slow. You don't see this so much because it's written in C++ and there's many clever optimizations (see point 1). But it's difficult to get around the fact that a syntax is hundreds of regexes that have to be run over the whole document in a pathologically slow manner. I hate to think what it would be like in JS.
3. Many TM language definitions are dependent on features of the Oniguruma regex engine, which is strictly more powerful than any JS one. So you basically have to compile Oniguruma (no mean feat) ...with emscripten.