-
Enhancement
-
Resolution: Fixed
-
P3
-
None
-
b23
-
generic
-
generic
The HTML5 specification does not contain a normative rule for formatting code snippets but it suggests the usage of `<pre>` elements with nested `<code>` elements and the use of a `class="language-xxx"` attribute on the latter to describe the language of the snippet.
https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element
https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
This also happens to be the format expected by popular syntax coloring tools such as Prism and highlight.js.
https://prismjs.com/index.html#basic-usage
https://highlightjs.org/usage/
JEP 413 describes a `lang` attribute for snippets that defines the language of the snippet. This attribute is currently ignored. It should be used to create a class attribute as described above.
In a related note, JEP 413 also describes an `id` attribute to identify the snippet in the generated documentation. This attribute is also currently ignored, it should be used to create an `id` attribute in an element containing the snippet.
https://html.spec.whatwg.org/multipage/text-level-semantics.html#the-code-element
https://html.spec.whatwg.org/multipage/grouping-content.html#the-pre-element
This also happens to be the format expected by popular syntax coloring tools such as Prism and highlight.js.
https://prismjs.com/index.html#basic-usage
https://highlightjs.org/usage/
JEP 413 describes a `lang` attribute for snippets that defines the language of the snippet. This attribute is currently ignored. It should be used to create a class attribute as described above.
In a related note, JEP 413 also describes an `id` attribute to identify the snippet in the generated documentation. This attribute is also currently ignored, it should be used to create an `id` attribute in an element containing the snippet.
- relates to
-
JDK-8275786 New javadoc option to add script files to generated documentation
-
- Resolved
-