JSDoc 中文网

Synonyms

语法

¥Syntax

@description <some description>

概述

¥Overview

@description 标签允许你提供正在记录的符号的一般描述。描述可以包括 HTML 标记。如果启用了 Markdown 插件,它还可能包括 Markdown 格式。

¥The @description tag allows you to provide a general description of the symbol you are documenting. The description may include HTML markup. It may also include Markdown formatting if the Markdown plugin is enabled.

示例

¥Examples

如果你在 JSDoc 注释的开头描述符号,则在使用任何块标记之前,你可以省略 @description 标记。

¥If you describe a symbol at the very beginning of a JSDoc comment, before using any block tags, you may omit the @description tag.

描述不带@description 标签的符号
/**

 * Add two numbers.

 * @param {number} a

 * @param {number} b

 * @returns {number}
 */
function add(a, b) {
    return a + b;
}

通过使用 @description 标签,你可以将描述放在 JSDoc 注释中的任何位置。

¥By using the @description tag, you can place the description anywhere in the JSDoc comment.

使用@description 标签描述符号
/**

 * @param {number} a

 * @param {number} b

 * @returns {number}

 * @description Add two numbers.
 */
function add(a, b) {
    return a + b;
}

如果 JSDoc 注释开头既有描述,又有 @description 标记提供的描述,则 @description 指定的描述将覆盖注释开头的描述。

¥If there's both a description at the beginning of a JSDoc comment and a description provided with the @description tag, the description specified with the @description will override the description at the beginning of the comment.