This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 243706 - JavaDoc comments containing HTML mark-up are unreadable after formatting.
Summary: JavaDoc comments containing HTML mark-up are unreadable after formatting.
Status: NEW
Alias: None
Product: java
Classification: Unclassified
Component: Editor (show other bugs)
Version: 8.0
Hardware: PC Windows 8 x64
: P2 normal with 3 votes (vote)
Assignee: Dusan Balek
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-04-09 17:04 UTC by predatorvi
Modified: 2015-07-28 09:25 UTC (History)
1 user (show)

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description predatorvi 2014-04-09 17:04:51 UTC
When embedding HTML for enhanced formatting of JavaDoc comment blocks, it helps readability if things are indented to match the HTML structure.

However, after formatting (if enabled), the formatter removes all leading whitespace/indentation making it harder to read or edit the JavaDoc comment source.

It would be lovely if HTML formatting rules (in some form) could be enabled and applied to the JavaDoc content.

Example before formatting:
/**
 * Categorization service
 * <p>
 * Categorization Information
 * <p>
 * <h3>ENDPOINTS</h3>
 * The endpoints and metadata detail:
 * <dl>
 *  <dt><b>update</b> ({@code http://<host>[:<port>]/categorization/update})</dt>
 *  <dd>Submits updates
 *  <ul>
 *      <li><b><i>Query Parameters:</i></b>
 *          <dl>
 *          <dt>{@code device}</dt>
 *              <dd></dd>
 *          <dt>{@code installedVersion}</dt>
 *              <dd></dd>
 *          </dl>
 *      <li><b><i>Request Headers:</i></b>
 *          <dl>
 *          <dt>{@code Client-Cert: {certWithSerialNo}}</dt>
 *              <dd></dd>
 *          <dt>{@code If-None-Match}</dt>
 *              <dd></dd>
 *          </dl>
 *      <li><b><i>Response Headers:</i></b>
 *          <dl>
 *          <dt>{@code ETag: "version_subversion_entitlementhash"}</dt>
 *              <dd></dd>
 *          <dt>{@code content-disposition: attachment; filename=content.tar}</dt>
 *              <dd></dd>
 *          </dl>
 * </ul></dd>
 * <dt><b>database</b> ({@code http://<host>[:<port>]/categorization/database/{filename}})</dt>
 * <dd>Retrieves the db info.
 * <ul>
 *      <li><b><i>Path Parameters:</i></b>
 *          <ul>
 *          <li>{@code fileName}
 *          </ul>
 *      <li><b><i>Request Headers:</i></b>
 *          <ul>
 *          <li>{@code Client-Cert: {certWithSerialNo}}
 *          <li>{@code If-Modified-Since} OPTIONAL: If exists, then pull from cache?
 *          </ul>
 *      <li><b><i>Response Headers:</i></b>
 *          <ul>
 *          <li>{@code content-disposition: attachment; filename={fileName}; {cacheControlHeader}}
 *          </ul>
 * </ul></dd>
 * </dl>
 * <p>
 */

Example After formatting:
/**
 * Categorization service.
 * <p>
 * Categorization information
 * <p>
 * <h3>ENDPOINTS</h3>
 * The endpoints and metadata detail:
 * <dl>
 * <dt><b>update</b> ({@code http://<host>[:<port>]/categorization/update})</dt>
 * <dd>Submits updates
 * <ul>
 * <li><b><i>Query Parameters:</i></b>
 * <dl>
 * <dt>{@code device}</dt>
 * <dd></dd>
 * <dt>{@code installedVersion}</dt>
 * <dd></dd>
 * </dl>
 * <li><b><i>Request Headers:</i></b>
 * <dl>
 * <dt>{@code Client-Cert: {certWithSerialNo}}</dt>
 * <dd></dd>
 * <dt>{@code If-None-Match}</dt>
 * <dd></dd>
 * </dl>
 * <li><b><i>Response Headers:</i></b>
 * <dl>
 * <dt>{@code ETag: "version_subversion_entitlementhash"}</dt>
 * <dd></dd>
 * <dt>{@code content-disposition: attachment; filename=content.tar}</dt>
 * <dd></dd>
 * </dl>
 * </ul></dd>
 * <dt><b>database</b> ({@code http://<host>[:<port>]/categorization/database/{filename}})</dt>
 * <dd>Retrieves the db info.
 * <ul>
 * <li><b><i>Path Parameters:</i></b>
 * <ul>
 * <li>{@code fileName}
 * </ul>
 * <li><b><i>Request Headers:</i></b>
 * <ul>
 * <li>{@code Client-Cert: {certWithSerialNo}}
 * <li>{@code If-Modified-Since} OPTIONAL: If exists, then pull from cache?
 * </ul>
 * <li><b><i>Response Headers:</i></b>
 * <ul>
 * <li>{@code content-disposition: attachment; filename={fileName}; {cacheControlHeader}}
 * </ul>
 * </ul></dd>
 */
Comment 1 Jiri Prox 2014-04-14 08:40:43 UTC
This sounds as good idea
Comment 2 mimkorn 2014-07-28 07:25:41 UTC
The state in which it is is actually worse. When you format first time, it will do it as shown in the example. However, if you do format again, it will split tags like this: 
before:
<pre>
after:
<
pre> which makes the tag non-readable by humans AND machines. 

It happened to me first time when I had this javadoc.

/** .....
returned. Say:
<p><pre>{@code {
"name" : cz
"text" : de
}}</pre></p>
*/

chaned into
/** .....
returned. Say:
<p>
<
pre>{@code {
"name" : cz
"text" : de
}}</pre></p>
*/
Comment 3 Tomas Zezula 2014-08-06 14:17:29 UTC
Makes sense to me.
It should use HTML formatting options, better it should be a html embedding which will provide all the HTML features like code completion.
It's rather a new feature request.
Comment 4 mimkorn 2015-07-26 15:39:04 UTC
Considering the <p> treatment as mentioned in my last comment (2) this looks more like a bug then a feature request to me. 

Any progress on this?
Comment 5 Dusan Balek 2015-07-28 09:25:49 UTC
The original issue is rather a new feature request, as has been already said.

To mimkorn: Splitting of <pre> html tags should be fixed in the current dev build.
If you are still able to reproduce it, please, file a new bug with the exact steps to reproduce. Thanks.