Currently I format code examples in my javadoc using the PRE tag e.g.:
/**
* Example javadoc
*
<pre>
String foo = "bar";
</pre>
*
* @return true if the operation completed
*/
But this turns out rather monotone and boring in the resulting javadoc, I’d much rather have some syntax highlighting similar to SyntaxHighlighter.
How can this be done?
You can use jQuery to get it done using the beautyOfCode plugin. I’m not sure if there’s an easy way to hook into the javadoc generation, but after-the-fact you can just do the following in your header:
and all text inside PRE tags will be highlighted as java. Check out the links above for more info.