RFR: JDK-8289332: Auto-generate ids for user-defined headings

Hannes Wallnöfer hannesw at openjdk.org
Tue Jul 26 09:06:55 UTC 2022


This is a simple change to automatically generate `id` attributes for HTML headers in documentation comments. 

I decided to leave the functionality in `HtmlDocletWriter` rather than moving it to `HtmlIds` because it uses the same helper methods as`commentTagsToContent`.

The value of the `id` attribute id derived from the content of the header tag with spaces and other non-word characters replaced by `-`. A `-hdr` suffix is appended to avoid collisions with other ids. If there are duplicate values an int counter is appended to make them unique.

-------------

Commit messages:
 - Remove trailing whitespace
 - JDK-8289332: Auto-generate ids for user-defined headings

Changes: https://git.openjdk.org/jdk/pull/9627/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=9627&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8289332
  Stats: 184 lines in 4 files changed: 173 ins; 6 del; 5 mod
  Patch: https://git.openjdk.org/jdk/pull/9627.diff
  Fetch: git fetch https://git.openjdk.org/jdk pull/9627/head:pull/9627

PR: https://git.openjdk.org/jdk/pull/9627


More information about the javadoc-dev mailing list