Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to generate HTML5 valid Javadoc?

I have generated HTML5 JavaDoc in the Eclipse Luna clicking Project -> Generate Javadoc...

The output is well-formated standard Javadoc HTML file, however, it's not HTML5 valid. For example, I find it not appropriate since I would like to upload the whole documentation to a website.

I have tested the generated files with W3 Validator.

How to force the generator to produce the HTML5 valid file including <!DOCTYPE html> at the beginning of the page and avoiding obsolete elements such as frameset or the incomplete elements at all.

like image 467
Nikolas Charalambidis Avatar asked Jun 09 '17 20:06

Nikolas Charalambidis


2 Answers

As far as I can tell this will be available in jdk-9 via jep-224. In java 8 current type is html4.

like image 53
Eugene Avatar answered Oct 09 '22 13:10

Eugene


On current (Photon) Eclipse select your project in Package Explorer view and go to :

Project > Generate Javadoc ...

This brings you to page 1 of the Javadoc set-up. After selecting the Javadoc command path, the project, the visibility and the output folder, click the Next button twice to get to page 3 of the set-up where you may enter various options for the Javadoc.exe command. Enter -html5 as your VM option.

It is best to enter -noqualifier all in the Javadoc options box in order to remove qualifier prefixes from each class. Otherwise the objects in the final Javadoc's Modifier & Type and Method columns would be given as java.lang.String rather than String and ArrayList as java.util.ArrayList. (It gets longer and sillier still for HashMap classes with proprietary classes) The effect of this is to slow down readability of the docs and reduce the available width of the (most important) Description column.

You can also add other options for things like custom tags here, e.g.

 -tag custom.date:a:"Date: "

so that the tag

  @custom.date: November 2018

shows as

  Date: November 2018

in the final Javadoc.

Finally click Finish button to start generating javadocs in HTML5 format.

Javadoc display configuration

like image 20
Trunk Avatar answered Oct 09 '22 14:10

Trunk