On Sun, Jan 31, 2010 at 05:00, Caleb James DeLisle <[email protected]> wrote:
Lately I have been playing with a few different javascript syntax highlighting libraries. One which I think shows some promise is google-code-prettify, used for highlighting on google code (Apache license.)
We did looked at JS highlight libraries before implementing code macro and it's true that some of them are impressive but we decided it was not a solution from rendering point of view. Use JS make the macro only work in a very specific environment. The current code macro is working for any kind of renderer. That said it would make sense to provide a JS based code macro on code.xwiki.org for example, should be easy to implement. Would be a good example of wiki macro.
Advantages of javascript highlighting: + We could remove Pygments and Jython, Jython weighs in at 8.3MB making it the largest jar in the lib folder, Pygments adds another 364K.
+ I understand Jython/Pygments has been responsible for recent out of permgen memory errors.
The implementation we are using is actually very young (that's the very first version of a complete rewrite of Jython) and I'm sure it will be improved in the future. For example it's officially known as way slower that the previous implementation but AFAIK the team is pretty dedicated to improve that, the first step was to provide a fully functional python implementation. Pygments is a great library which supports a lot's of syntaxes and is pretty active.
+ Shifts work from server to client.
It's not an obvious pro for me. Especially when we are talking about IE.
+ Adding a js syntax highlighting library to the svn repository allows us to patch it to support xwiki syntax (switch lexers when macros are detected.)
I'm not sure to understand what you mean here. Note that code macro does not depends on Pygments. It provides it's own highlighting system and a bridge to Pygments when no parser is provided for a given syntax. It means all syntaxes for now but it's very easy to provide parsers for any language not supported by Pygments or if you have a pure Java parser for example (anyway even add a Pygments lexer is not too difficult).
+ Relatively easy compared to other performance boosters.
Disadvantages: - Some users do not use Javascript.
- Highlighting may be slow on old computers when lots of code is displayed.
- Removing Jythion from the default build will add a step to upgrading for wiki operators who are using the {{python}} macro.
I don't think that's a real issue, it's would be easy for someone to install the python macro like the jruby one.
- Adds another js file to download which hurts page load speed until a js bundling plan is in place.
If there is significant interest, I could put up a comparison page on the incubator.
Caleb
_______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
-- Thomas Mortagne