Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add example usage (markdown?) to JavaDocs

Say I have this:

enter image description here

Is there a way to add markdown or html to each method, with an example of how to use the method? I am thinking an expanding panel - button says view example and it opens a panel.

I tried adding this to the inline docs:

 /**
   * <pre>
   * <code>new BeanTranslator.Builder()
   *   .translate(
   *     new{@code Translator<String, Integer>}(String.class, Integer.class){
   *      {@literal @}Override
   *       public Integer translate(String instance) {
   *         return Integer.valueOf(instance);
   *       }})
   *   .build();
   * </code>
   * </pre>
   */
  @SuppressWarnings("Duplicates")
  public static <I, T, V, E> void Reduce(I initialVal, List<T> tasks, Asyncc.Reducer<V, E> m, Asyncc.IAsyncCallback<V, E> f) {
    NeoReduce.Reduce(initialVal, tasks, m, f);
  }

but I only see this on the right side:

enter image description here

like image 257
Alexander Mills Avatar asked Dec 01 '25 05:12

Alexander Mills


1 Answers

There is a library that allows to use Markdown and even PlantUML in Javadocs like this:

/**
* Java Example:
*
* ```java
* @Override
* public void myMethod() {
* }
* ```
*/
like image 63
Tom Avatar answered Dec 03 '25 20:12

Tom



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!