RFR: 8348282: Add option for syntax highlighting in javadoc snippets [v4]

Nizar Benalla nbenalla at openjdk.org
Thu Apr 24 15:25:51 UTC 2025


On Wed, 9 Apr 2025 04:15:20 GMT, Hannes Wallnöfer <hannesw at openjdk.org> wrote:

>> Please review a change to add a `javadoc` option to enable syntax highlighting for code fragments in snippets and  `<pre><code>` tags. The new `--syntax-highlight` option uses the [highlight.js] JavaScript library and supports Java, Properties, XML, HTML and JSON. The option is enabled in the JDK API docs target, [generated output is available here](https://cr.openjdk.org/~hannesw/8348282/api.00/index.html).
>
> Hannes Wallnöfer has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Adjust color palette

Javadoc changes look good! I also checked that the test runs fine when using `make test TEST=<path>/TestSyntaxHighlightOption.java`.

I wonder if we can push for the conversion of some  `<blockquore><pre>` to `@snippet` so that we can benefit more from this new feature. I checked some older classes and the use of `<blockquore><pre>` is still widespread.

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

Marked as reviewed by nbenalla (Committer).

PR Review: https://git.openjdk.org/jdk/pull/24417#pullrequestreview-2791628352


More information about the javadoc-dev mailing list