RFR: 8352511: Show additional level of headings in table of contents
Hannes Wallnöfer
hannesw at openjdk.org
Thu Mar 20 17:37:51 UTC 2025
Please review a patch to show an additional level of headings in the table of contents for module, package and class descriptions. Previously only `<h2>` headings were shown in the table of contents, now we also show `<h3>` level headings.
The `TableOfContents` class no longer provides `pushNestedList`/`popNestedList` methods that require us to manually manage nesting level. Instead, the method to add a TOC entry gets an additional `level` parameter with an enum type to specify the nesting level (`FIRST`, `SECOND`, `THIRD`). The class will then configure the list to the desired nesting level before adding the entry. Of course this works with both tradidtional and Markdown doc comments and has tests for both.
There are not too many API elements in JDK that use `<h3>` level headings, but those that do benefit a lot from this change. A few examples:
- [package java.util.stream](https://cr.openjdk.org/~hannesw/8352511/api.00/java.base/java/util/stream/package-summary.html)
- [package java.lang.classfile](https://cr.openjdk.org/~hannesw/8352511/api.00/java.base/java/lang/classfile/package-summary.html)
- [package java.lang.invoke](https://cr.openjdk.org/~hannesw/8352511/api.00/java.base/java/lang/invoke/package-summary.html)
- [package java.lang.module](https://cr.openjdk.org/~hannesw/8352511/api.00/java.base/java/lang/module/package-summary.html)
This PR depends on #24083 not for technical reasons but because that PR fixes the rendering of the third level of TOC entries.
-------------
Depends on: https://git.openjdk.org/jdk/pull/24083
Commit messages:
- Remove trailing whitespace
- 8352511: Show additional level of headings in table of contents
Changes: https://git.openjdk.org/jdk/pull/24137/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=24137&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8352511
Stats: 348 lines in 19 files changed: 240 ins; 44 del; 64 mod
Patch: https://git.openjdk.org/jdk/pull/24137.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/24137/head:pull/24137
PR: https://git.openjdk.org/jdk/pull/24137
More information about the javadoc-dev
mailing list