Java 9 : HTML5 in Javadocs - HTML5 tags in the Javadoc comments

Generate javadocs to HTML content using java command

HTML5 provides better browser compatibility. It is also more mobile-friendly than
its predecessor, HTML4. But to take advantage of HTML5, one has to specify the html5 parameter during Javadoc generation. Otherwise, only HTM4-style comments
will continue to be supported.

Here is an example of the HTML5 tags used for Javadoc comments:
/**
<h2>Returns the weight of the car.</h2>
<article>
<h3>If life would be often that easy</h3>
<p>
Do you include unit of measurement into the method name or not?
</p>
<p>
The new signature demonstrates extensible design of an interface.
</p>
</article>
<aside>
<p> A few other examples could be found
<a href="http://www.nicksamoylov.com/cat/programming/">here</a>.
</p>
</aside>
* @param weightUnit - an element of the enum Car.WeightUnit
* @return the weight of the car in the specified units of weight
*/
int getMaxWeight(WeigthUnit weightUnit);

If you are using IntelliJ IDEA, go to Tools | Generate JavaDoc... and set the -html5
value in the Other command line arguments field and click on OK. Without an IDE,
use the following command:

javadoc [options] [packagenames] [sourcefiles] [@files]

The resulting Javadoc will look like this:



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation