Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8352691

Add option for syntax highlighting in javadoc snippets

XMLWordPrintable

    • Icon: CSR CSR
    • Resolution: Unresolved
    • Icon: P3 P3
    • 25
    • tools
    • None
    • behavioral
    • minimal
    • add/remove/modify command line option
    • JDK

      Summary

      Add javadoc option to enable syntax highlighting for sample code in generated documentation.

      Problem

      Syntax highlighting for code samples is a standard feature in documentation for programming languages. While it is possible to add syntax highlighting using the existing --add-script and --add-stylesheet options, there should be a one-stop solution to configure syntax highlighting for Java with a single command line option.

      Solution

      Add a no-argument option to enable syntax highlighting in generated documentation. Syntax highlighting will use a non-configurable color scheme crafted to work with default JavaDoc stylesheets, and support Java syntax as well as a limited number of other syntaxes such as properties files and HTML. Syntax highlighting will use the lang attribute in snippet tags to determine the snippet syntax. For plain <pre><code> and <pre>{@code} tags the script will use auto-detection to determine the syntax to use, if any.

      Specification

      Add the following option to the Javadoc Standard Doclet:

          --syntax-highlight
              Enable syntax highlighting for snippets and other code samples

            hannesw Hannes Wallnoefer
            hannesw Hannes Wallnoefer
            Chen Liang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: