On 01/31/2010 05:00 AM, Caleb James DeLisle 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.)
Yes, I've looked at it a few days ago, too.
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.
Jython is not just for syntax highlighting, but as a scripting macro.
+ I understand Jython/Pygments has been responsible
for recent out of permgen
memory errors.
+ Shifts work from server to client.
+ 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.)
+ Relatively easy compared to other performance boosters.
If there are problems with Jython, I'm sure they can be solved, too. The
problem is that we're not giving so much importance to it, since we have
other more important issues to solve. Some of the problems could be as
simple as not using it the right way (bad config, bad usage patterns),
while some could be reported as bugs to the jython devs, since we could
be using it in a way that they haven't predicted.
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.
- Adds another js file to download which hurts page load speed until a js
bundling plan is in place.
I agree with Vincent here, for the {{code}} macro we should use the
server-side highlighting. But we could use client-side highlighting for
textareas, for example a first step would be to add it to the JSX/SSX
textareas.
If there is significant interest, I could put up a
comparison page on the
incubator.
--
Sergiu Dumitriu
http://purl.org/net/sergiu/