How to make IntelliJ to break javadoc lines on </p>
I was using </p>
tag to break lines in Javadoc. It was both old-fashion and working in Elcipse. Unfortunetely, it does not work in IntelliJ:
As you see, there is no wrap between "to javadoc" and "This is it".
Simultaneously, Eclipse works fine:
Code is follows (don't regard image path -- it is from other test):
package tests.helloworld;
/**
* This is try to javadoc</p>
* This is it
* <img src="/myimage.jpg">
*/
public class Runner {
public static void main(String[] args) {
System.out.println("Hello world");
}
}
UPDATE
Of course generated javadoc is OK in browser:
While <p> [...] </p>
formatting is probably more concise/understandable, if you just want line breaks you can use <br>
:
/**
* This is try to javadoc<br>
* This is it
* <img src="/myimage.jpg">
*/
Example:
You'll need to use <p>
instead of </p>
. The opening tag is required in HTML, while the closing </p>
tag may be omitted in certain cases.
See https://developer.mozilla.org/en-US/docs/Web/HTML/Element/p:
The start tag is required. The end tag may be omitted if the
<p>
element is immediately followed by an<address>
,<article>
,<aside>
,<blockquote>
,<div>
,<dl>
,<fieldset>
,<footer>
,<form>
,<h1>
,<h2>
,<h3>
,<h4>
,<h5>
,<h6>
,<header>
,<hr>
,<menu>
,<nav>
,<ol>
,<pre>
,<section>
,<table>
,<ul>
or another<p>
element, or if there is no more content in the parent element and the parent element is not an<a>
element.
In Javadoc, usually there's either another <p>
tag or there is no more content in the parent element so this works.
Note: If you searched for JavaDoc using Kotlin:
On IntelliJ IDEA 2020 neither <p></p>
nor <br>
work for Kotlin, only a blank line.
Even worse, sentences in <p></p>
are not displayed at all.
KDoc Documentation