如何格式化 javadoc 注释中的标题,使其与 @param
的格式匹配, @return
, 或 @throws
.我不是问如何定义我自己的关键字,而是问如何使用与它们类似的粗体标题。
我试过了<h1></h1>
但它在 Eclipse 的 Javadoc View 中看起来很糟糕,特别是尺寸要大得多。有替代品还是<h1></h1>
怎么走?
/**
* foo
*
* @param x foo
* @return foo
* @throws foo
*/
public int foo(int x) { return x; }
截图来自Eclipse。
更新
我不认为<strong>
就足够了,因为它不添加换行符:
/**
* Introdcution
*
* <strong>Heading</strong>There is no line break.
* <strong>Heading</strong>There is no line break.
*
* @param x foo
* @return foo
* @throws foo
*/
最佳答案
只需查看 JAVA API 生成的 Java Doc,例如SimpleDateFormat.parse (查看 HTML 源代码)。
他们使用 html 描述列表进行格式化,并使用 strong
CSS 类来格式化术语。照样做:
/**
* Introdcution
*
* <dl>
* <dt><span class="strong">Heading 1</span></dt><dd>There is a line break.</dd>
* <dt><span class="strong">Heading 2</span></dt><dd>There is a line break.</dd>
* </dl>
*
* @param x foo
* @return foo
* @throws foo
*/
看起来像这样:
关于java - 如何格式化 javadoc 注释中的标题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18054767/