javadoc的语法高亮?

问题描述:

目前我在我的javadoc中使用PRE标签格式化代码示例,例如:

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
 */



SyntaxHighlighter 。

如何做到这一点?

您可以使用 jQuery 使用 beautyOfCode 插件。我不确定是否有一种简单的方法来挂钩javadoc代,但事后你可以在你的标题中执行以下操作:

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');  
});

并且PRE标签内的所有文本都将突出显示为java。查看上面的链接以获取更多信息。

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