如何设置格式的标题在javadoc注释,以便它们匹配的格式@param,@return或@throws.我不是问如何定义我自己的关键词,而是如何设置一个类似于它们的大胆的脸.
我试过<h1></h1>但在Eclipse的Javadoc视图中看起来很糟糕,特别是尺寸要大得多.有替代方案还是<h1></h1>要走的路?
/**
* foo
*
* @param x foo
* @return foo
* @throws foo
*/
public int foo(int x) { return x; }
Run Code Online (Sandbox Code Playgroud)

截图来自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
*/
Run Code Online (Sandbox Code Playgroud)

FrV*_*aBe 10
只需查看生成的JAVA API Java Doc,例如SimpleDateFormat.parse(查看HTML源代码).
他们使用html描述列表进行格式化,使用strongCSS类来格式化术语.所以这样做:
/**
* 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
*/
Run Code Online (Sandbox Code Playgroud)
看起来像这样:

使用:
/**
* <strong>Heading</strong>There is no line break.
* <br /> <strong>Heading</strong>There is no line break.
*
* @param x foo
* @return foo
* @throws foo
*/
public int foo(int x) { return x; }
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7522 次 |
| 最近记录: |