Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Including images in javadocs

I work with a lot of sample test cases that are visual. Is there any convenient way to include them in my Java source and link them in Javadocs, so my IDE can automatically show them while coding (by invoking a javadoc renderer feature in my IDE?)

I tried putting an image next to the Java source and using <img>, but it's not taking (I used a png).

(note - it's in my test sources in this case)

like image 224
ianpojman Avatar asked May 28 '12 03:05

ianpojman


People also ask

Can Javadoc comments contain HTML?

A doc comment is written in HTML and must precede a class, field, constructor or method declaration. It is made up of two parts -- a description followed by block tags. In this example, the block tags are @param , @return , and @see .

What are javadocs and when should they be used?

Javadoc is a tool which comes with JDK and it is used for generating Java code documentation in HTML format from Java source code, which requires documentation in a predefined format.

What is the point of javadocs?

Javadoc is a tool for generating API documentation in HTML format from doc comments in source code. The purpose of the API is to provide information about code so other programmers can use it without needing a thorough knowledge of its inner workings.


1 Answers

A bit far fetched, but you can inline the images in the documentation by converting them into Base64. It would look like this:

<img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADIA..." /> 

There are online tools available to do the conversion:

  • http://www.base64-image.de
  • http://daturi.me
  • http://www.freeformatter.com/base64-encoder.html
like image 183
Emmanuel Bourg Avatar answered Oct 02 '22 15:10

Emmanuel Bourg