Eclipse - 如何在 class/method 的评论部分创建 table?
Eclipse - How do I create a table in the comment section of class/method?
我想使用 <\tbody>
、<\tr>
和 <\td>
在方法的注释部分创建一个 table :
<tbody>
<tr>
<td>personId</td>
<td>y</td>
<td>identifiant</td>
<td>C16</td>
<td>String</td>
</tr>
<tr>
<td>lastName</td>
<td>n</td>
<td>nom</td>
<td>C32</td>
<td>String</td>
</tr>
</tbody>
不幸的是,它不起作用,因为我在 Java 文档中没有看到 table,只有以下内容:
personId y identifiant C16 String lastName n nom C32 String
我该怎么办? <\table>
标签不是由 Eclipse 提出的,如果我使用它,它也不会改变任何东西。如果重要的话,我正在使用 eclipse Neon。
首先,你应该指定 tbody
之前的 table
元素符合 the table
element :
Permitted content
In this order:
an optional caption element,
zero or more colgroup elements,
an optional thead element,
either one of the following:
zero or more tbody elements
one or more tr elements
an optional tfoot element
其次,您不需要 Eclipse 向导或工具来使用 HTML 标记记录您的 Javadoc。
只需在 javadoc 注释中写下您的 HTML 内容即可:
/**
<table><tbody>
<tr>
<td>personId</td>
<td>y</td>
<td>identifiant</td>
<td>C16</td>
<td>String</td>
</tr>
<tr>
<td>lastName</td>
<td>n</td>
<td>nom</td>
<td>C32</td>
<td>String</td>
</tr>
</tbody></table>
*/
public void foo(){
...
}
并且它应该在 javadoc 视图或生成中以表格方式显示它:
void foo()
personId y identifiant C16 String
lastName n nom C32 String
您可以使用 markdown 样式 table。对于开发人员而言,它比 HTML 更具可读性。
示例:
/**
* 2 Device Connected possible states matrix
*
| | DIALING | ON_HOLD | RINGING | ON_CALL | IDLE |
|---------|---------|---------|---------|---------|------|
| DIALING | -- | YES | YES | YES | YES |
| ON_HOLD | YES | YES | YES | YES | YES |
| RINGING | YES | YES | YES | YES | YES |
| ON_CALL | YES | YES | YES | -- | YES |
| IDLE | YES | YES | YES | YES | YES |
*/
您可以从此处在 markdown 中生成 table
作为替代变体,使用 <pre></pre>
标签呈现 markdown tables
/**
* Description
* <pre>
| Key | Value |
|-------|-------------|
| 1 | Value1 |
| 2 | Value2 |
*</pre>
*/
生成:
您可以使用此 tool 并指定输出样式为 HTML。
我想使用 <\tbody>
、<\tr>
和 <\td>
在方法的注释部分创建一个 table :
<tbody>
<tr>
<td>personId</td>
<td>y</td>
<td>identifiant</td>
<td>C16</td>
<td>String</td>
</tr>
<tr>
<td>lastName</td>
<td>n</td>
<td>nom</td>
<td>C32</td>
<td>String</td>
</tr>
</tbody>
不幸的是,它不起作用,因为我在 Java 文档中没有看到 table,只有以下内容:
personId y identifiant C16 String lastName n nom C32 String
我该怎么办? <\table>
标签不是由 Eclipse 提出的,如果我使用它,它也不会改变任何东西。如果重要的话,我正在使用 eclipse Neon。
首先,你应该指定 tbody
之前的 table
元素符合 the table
element :
Permitted content
In this order:
an optional caption element,
zero or more colgroup elements,
an optional thead element,
either one of the following:
zero or more tbody elements
one or more tr elements
an optional tfoot element
其次,您不需要 Eclipse 向导或工具来使用 HTML 标记记录您的 Javadoc。
只需在 javadoc 注释中写下您的 HTML 内容即可:
/**
<table><tbody>
<tr>
<td>personId</td>
<td>y</td>
<td>identifiant</td>
<td>C16</td>
<td>String</td>
</tr>
<tr>
<td>lastName</td>
<td>n</td>
<td>nom</td>
<td>C32</td>
<td>String</td>
</tr>
</tbody></table>
*/
public void foo(){
...
}
并且它应该在 javadoc 视图或生成中以表格方式显示它:
void foo()
personId y identifiant C16 String
lastName n nom C32 String
您可以使用 markdown 样式 table。对于开发人员而言,它比 HTML 更具可读性。
示例:
/**
* 2 Device Connected possible states matrix
*
| | DIALING | ON_HOLD | RINGING | ON_CALL | IDLE |
|---------|---------|---------|---------|---------|------|
| DIALING | -- | YES | YES | YES | YES |
| ON_HOLD | YES | YES | YES | YES | YES |
| RINGING | YES | YES | YES | YES | YES |
| ON_CALL | YES | YES | YES | -- | YES |
| IDLE | YES | YES | YES | YES | YES |
*/
您可以从此处在 markdown 中生成 table
作为替代变体,使用 <pre></pre>
标签呈现 markdown tables
/**
* Description
* <pre>
| Key | Value |
|-------|-------------|
| 1 | Value1 |
| 2 | Value2 |
*</pre>
*/
生成:
您可以使用此 tool 并指定输出样式为 HTML。