JsDoc Toolkitを使う!

@description

最終更新:

aias-jsdoctoolkit

- view
管理者のみ編集可

トップページ > ドックコメントの書き方 > タグリファレンス >

@description

@descriptionタグを使用して、ドキュメントに含まれるほぼ全ての要素(関数、変数、コンストラクタなど)に対し説明文を記述することができます。

別名

@desc

構文

@description description

  • description -- 必須:この項目の説明
  • @descriptionタグは複数記述できます。

要素について説明文を書くことは非常に有用でありまた一般的でもありますが、このタグはごくまれにしか使われません。というのも慣例的に、ドックコメントの1行目がタグ付きでない場合それは要素の説明であるとみなされるからです。例えば以下に示す2つのドックコメントは全く同じ働きをします。

@descriptionタグを使った明示的な説明の記述

/**
  @description Creates a new Person.
  @constructor
 */

Person = function() {
}

1行目がタグ付けされていないことによる、暗黙的な@descriptionタグ

/**
  Creates a new Person.
  @constructor
 */

Person = function() {
}

このタグが必須となるのは、説明文をドックコメントの1行目以外の位置に記述したい場合だけです。

/**
  @deprecated
  @description Creates a new Person.
 */

Person = function() {
}

注意:他の全てのタグと同じく、説明文が複数行にわたることや、そこに含まれる文字についての制限はありませんが、行の最初を@という文字から始めることだけはできません。
下は、改行やHTMLタグを含む説明文の例です。

/**
  <p>Creates a new Person, representative of a living human being,
  in addition to the collection of characteristics that define and
  distinguish an individual personality; the self.</p>
  
  <p>The word can be traced to the latin word <i>persona</i> for
  "human being," originally "character in a drama," possibly borrowed
  from the ancient Etruscan word <i>phersu</i> for "mask."</p>
  
  @constructor
 */

Person = function() {
}


目安箱バナー