[英]How to format a heading in a javadoc comment?
如何設置格式的標題在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; }
截圖來自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
*/
看起來像這樣:
使用:
/**
* <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; }
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.