你知道在JSDoc中是否有类似于<code />
标签的东西吗?我需要在我的文档中添加代码片段,就像这样:
/**
* This function does something see example below:
*
* var x = foo("test"); //it will show "test" message
*
* @param {string} str: string argument that will be shown in message
*/
function foo(str)
{
alert(str);
}
我需要注释中的代码能够像代码一样(如果没有语法高亮,至少像预格式化文本那样显示,带有灰色背景)由JSDoc显示出来。
<pre>
和<code>
,但它们都只是在Intellisense中被字面上写出来。然而,我刚刚意识到Markdown似乎也被支持了!!! 因此,用反引号(`)包围行内代码就可以了。 :) - Jonathan Benn