2013-07-20 33 views
0

有沒有辦法在IntelliJ IDEA的文檔註釋中臨時呈現HTML標記?我希望能夠做到這一點,因爲它使閱讀一些文檔更容易。例如,從JUnit的源考慮下面的代碼片段:IntelliJ IDEA - 在Java中呈現HTML標記文檔評論

/** 
* The <code>Test</code> annotation tells JUnit that the <code>public void</code> method 
* ... 
* ... 
* <p> 
* A simple test looks like this: 
* <pre> 
* public class Example { 
* <b>&#064;Test</b> 
* public void method() { 
*  org.junit.Assert.assertTrue(new ArrayList().isEmpty()); 
* } 
* } 
* </pre> 
* <p> 
* The <code>Test</code> annotation supports two optional parameters. 
* The first, <code>expected</code>, declares that a test method should throw 
* ... 
* ... 
* <pre> 
* &#064;Test(<b>expected=IndexOutOfBoundsException.class</b>) public void outOfBounds() { 
*  new ArrayList&lt;Object&gt;().get(1); 
* } 
* </pre></p> 
* <p> 
* The second optional parameter, <code>timeout</code>, causes a test to fail if it takes 
* longer than a specified amount of clock time (measured in milliseconds). The following test fails: 
* <pre> 
* &#064;Test(<b>timeout=100</b>) public void infinity() { 
*  while(true); 
* } 
* </pre> 
* <b>Warning</b>: while <code>timeout</code> is useful to catch and terminate 
* infinite loops, it should <em>not</em> be considered deterministic. The 
* ... 
* ... 
* <pre> 
* &#064;Test(<b>timeout=100</b>) public void sleep100() { 
*  Thread.sleep(100); 
* } 
* </pre> 
* 
* 
* @since 4.0 
*/ 

所有的標記,就更不用說了HTML編碼,使得它一點點難以解析的文檔。

我試圖尋找一種方法來做到這一點,但沒有任何意義。也許我沒有使用正確的關鍵字?

回答

1

您可以在註釋本身或插入符號的代碼中的某個位置使用快速文檔(Ctrl-Q/menu - > view - >快速文檔) - 例如,在測試中

@Test 
public void myTest() throws Exception