2016-05-14 128 views
0

這是我第一次使用jsdocs3,我無法生成我的文檔。 我創建了一個文件app.js並插入以下意見: -jsdocs3沒有文檔生成

/** 
* Main file - All modules are loaded. 
* @author My Name 
* 
*/ 

然後我跑的命令./node_modules/jsdoc/jsdoc.js ./app/app.js -r -d文檔/,結果如下圖所示: -

enter image description here

我自己也嘗試了上面的命令與--debug PARAM和我看得出來,jsdocs3能夠解析文檔並沒有任何被完成錯誤。

我不知道我在做什麼錯。任何幫助表示讚賞?

回答

0

jsdoc在語法分析和jsdoc註釋解析中生成它的文檔。 您需要在文件中使用jsdoc可能識別的一些函數/對象/模塊定義。

無論是模塊出口:

/** 
* Fooer 
*/ 
module.exports.foo = function() { 

}; 

類定義:

/** 
* Some class. 
* @constructor 
*/ 
function SomeClass() { 

    /** 
    * Foo it 
    * @param x data 
    */ 
    this.foo = function(x) { }; 

}; 

您還可以定義文件本身:

/** 
* Awesome module. 
* @author John Doe 
* @file test.js 
*/