How to create multiple levels of indentation in Javadoc?

Suppose, that as part of documenting your code (Javadoc) you want to indicate that the relationships between elements using deep indentation.

How can I create a nested list as:

  • some element
    • some other element
      • yet some other element
81512 次浏览
<ul>
<li>Element</li>
<ul>
<li>Subelement...</li>

您可以在 javadoc 注释中相当自由地使用 HTML。

更新: 因为它出现了,我尝试了

<ul>
<li>one</li>
<ul>
<li>one point one</li>
</ul>
</ul>

and get

    • 1.1

I agree proper nesting is better.

嵌套列表应该在它自己的 <li>内。 <ul>不是 <ul>的有效子元素。

所以你的例子是:

<ul>
<li>some element</li>
<li>
<ul>
<li>some other element</li>
<li>
<ul>
<li>yet some other element</li>
</ul>
</li>
</ul>
</li>
</ul>

The correct way is as follows:

/**
* <ul>
*   <li>some element
*   <li><ul>
*     <li>some other element
*     <li><ul>
*       <li>yet some other element
*     </ul>
*   </ul>
* </ul>
*/

虽然 JavaDoc 借用 HTML,但它不是 HTML,您应该省略 </li>标记,就像您应该省略 </p>标记一样。