在JavaScript评论中,我想提一下某个文件中存在的方法。如何在评论中链接到该方法?例如。
说我的方法是:
function xyz() {
}
并说我正在写评论
// See also {method-link to xyz}
{method-link}应该是什么?
要链接到JSDoc中的“其他”,包括另一种方法,请使用{@link ...}
标记。在您的情况下,您将使用:
// See also {@link xyz}
然后,您可以在WebStorm中按住Ctrl键并单击xyz
。
用于“其他东西”的JSDoc术语是“namepath”。下面是安德鲁的原始答案,它解释了名称路径。
myFunction
MyConstructor
MyConstructor#instanceMember
MyConstructor.staticMember
MyConstructor~innerMember // note that JSDoc 2 uses a dash
/** A module. Its name is module:foo/bar.
* @module foo/bar
*/
/** The built in string object. Its name is external:String.
* @external String
*/
/** An event. Its name is module:foo/bar.event:MyEvent.
* @event module:foo/bar.event:MyEvent
*/
markdown
style in comment:// see function name in file dir/file.name
// see the method [named of the method](file-name #method name)