Javadoc => How to add a cool title label

I tried to add this type of header part to my javadocs, I could not do it in a simple and useful way. The only way to do this was with HTML, and I don't think HTML should have a place in the code.

enter image description here

This is the javadoc example I made. I want my javadoc to look exactly like androids, so I want to add a red square header part without going into HTML.

enter image description here

+7
java javadoc
source share
3 answers

If you want your generated documentation to contain links to classes such as java.lang.String , you must tell javadoc where to set the link. For example. on the command line you can say

 -link http://docs.oracle.com/javase/7/docs/api/ 

This is not done automatically, as you need to decide which version to link to or whether you want to link to a local mirror. The command line may have several -link to link to several bibliographic documents.

Additional headers for each method are not supported by the standard doclet. But you can add your own tags below the text of the documentation. For example, you can define your own tag, for example @API.level.1 , and add it to the documentation comments below the text (in one line) and run javadoc with

 -tag "API.level.1:a:Added in <a href='http://mycompany/Version1'>API Level 1</a>" 

to create a line similar to your example (although it will be below the text).


No text formatting without HTML except {@code …} and {@literal …} . If you need more options, you need to write Taglets for a specific option. This is the easiest way to achieve a separation between the source code and the HTML code, which you think makes sense. This way you can define semantic @tags and implement specific formatting with Taglet.

Or you write the whole Doclet to have full control over the output, but I don’t think you want it.


But first you should start reading the JavaDoc documentation (again), as there may be some parameters that you have missed yet, which may not give the exact results that you asked for, but let me improve your documentation, which may change your priorities. (This can help to find out everything that is possible before you start coding things that are not yet possible.)

+7
source share

How about a style like this:

<i><b>public void doSomething({@link String}).</b></i>

It looks the way you want it.

+3
source share

You can watch this post. I think this is similar to what you want to do. Javadoc associated with another package

+2
source share

All Articles