On Apr 24, 2012, at 7:31 AM, Daniel Gruno wrote:

After some fruitful discussions on IRC yesterday, I have tried out
various ways of making syntax highlighting available for our
documentation, and I've come across a method of doing so using
JavaScript. The results seem to be very good, and before everybody runs
away screaming because I mentioned the evil J-word, bear in mind that
although this method requires a small fraction of a second to properly
display the colors in your browser, it has the advantage of much smaller
page sizes on our side, as we won't need to pre-pack our documents with
a thousand class tags within each example source code.

I have put up a test of highlighting using JS at
http://www.humbedooh.com/apache/modguide.html.en which displays a
similar result to what is achieved using the manual highlighting I have
previously been using, with the added benefit of smaller size AND no
more complaining from the build system that the XML is invalid, provided
we adopt the following changes:

1) Modify common.dtd to allow classes inside <pre> tags
2) Modify common.xsl to include the style sheet and scripts used for
highlighting the source code examples in our documentation.

To create syntax highlighted source code examples, the only requirement
would be that you use the following syntax:

<pre class="sh_c">
code_goes_here(foo);
</pre>

A great big +1 to this in concept. At the very least, worth experimenting with in trunk. However, remember that the build stuff is the same in all branches, so changes affect everywhere.

What other languages are available for syntax coloring? Trying to remember what other examples we might have in the docs. Perl, I expect.

--
Rich Bowen
rbowen@rcbowen.com :: @rbowen
rbowen@apache.org