简体   繁体   English

JSDoc 注释块中是否允许使用制表符?

[英]Are tabs allowed in a JSDoc comment block?

Is it allowed to use tabs in a JSDoc comment block?是否允许在 JSDoc 注释块中使用选项卡?

    /**
     * Some description
     *
     * @function
     * @name            someName
     * @summary         And a summary
     */

Instead of...代替...

    /**
     * Some description
     *
     * @function
     * @name someName
     * @summary And a summary
     */

It seems JSDoc doesn't have a specification which states whether tabs work or not. JSDoc 似乎没有说明选项卡是否有效的规范。 But looking at The JSDoc website , it seems all of their examples don't use tabs.但是查看JSDoc 网站,似乎他们所有的示例都不使用选项卡。

BUT , I tried creating 3 functions - 1 with tabs in the doc, 1 with long tab spacing in the doc and 1 without tabs and use the JSDoc doc generator on them and it seems to work just fine.但是,我尝试创建 3 个函数 - 1 个在文档中带有制表符,1 个在文档中带有长制表符间距,1 个没有制表符,并在它们上使用 JSDoc 文档生成器,它似乎工作得很好。

The test functions I used:我使用的测试功能:

/**
 * This function receives 3 variables and returns their sum
 * @param   {int}   myvar   - A number
 * @param   {int}   myvara  - A number
 * @param   {int}   myvarb  - A number
 * @return  {int}             The sum of all numbers
 */
function testwithtabs(myvar, myvara, myvarb) {
  return myvar+myvara+myvarb;
}

/**
 * This function receives 3 variables and returns their sum
 * @param   {int}           myvar   - A number
 * @param   {int}           myvara  - A number
 * @param   {int}           myvarb  - A number
 * @return  {int}                     The sum of all numbers
 */
function testwithlargetabs(myvar, myvara, myvarb) {
  return myvar+myvara+myvarb;
}

/**
 * This function receives 3 variables and returns their sum
 * @param  {int} myvar - A number
 * @param  {int} myvara - A number
 * @param  {int} myvarb - A number
 * @return {int}        The sum of all numbers
 */
function testnotabs(myvar, myvara, myvarb) {
  return myvar+myvara+myvarb;
}

So going by this, even though tabs aren't specified in the examples, they will work just fine and you are free to use whatever you are comfortable with因此,即使示例中没有指定选项卡,它们也能正常工作,您可以随意使用任何您喜欢的东西

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM