I am documenting a java method using Javadoc. On occasion I use <pre>
tags for fromatting. Inside the <pre>
tags I use tags like <em>
, <b>
etc. to format the text. Sometimes the lines get very long due to the tags that do not show later. So I would like to insert a linebreak for readability in the Javadoc that will not show later. The following example shall clarify what I am trying to do:
/**
* <pre>
*
* <b><em>This</em></b> is <em><b>a</em></b> very <em><b>short</em></b> <em>sentence</em>
*
* </pre>
*
This will later show in the browser as
This is a very short sentence
As you can see, the tags make the sentence very long in the editor, so I want to insert a newline in the editor to improve readability, but it shall display as one line in the browser.
/**
* <pre>
*
* <b><em>This</em></b> is <em><b>a</em></b> <supress this newline>
* very <em><b>short</em></b> <em>sentence</em>
*
* </pre>
Is there a way to suppress a newline inside <pre>
tags? If not, can a similar result be achieved without using <pre>
tags?
答案 0 :(得分:3)
这不是一个javadoc问题,它是一个普遍的HTML问题。
您可以使用HTML评论:
/**
* <pre>
*
* <b><em>This</em></b> is <em><b>a</em></b> <!--
* -->very <em><b>short</em></b> <em>sentence</em>
*
* </pre>