views:

173

answers:

1

Hi,

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.

Any pointers appreciated, thanks.

+2  A: 

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:

$(function(){  
    $("pre").beautifyCode('java');  
});

and all text inside PRE tags will be highlighted as java. Check out the links above for more info.

Mike Trpcic