如何在jsdoc中添加和使用标签?

5
我正在尝试向jsdoc添加自定义标签。我已经在插件目录中创建了一个文件,内容如下: method.js
exports.defineTags = function(dictionary) {
    dictionary.defineTag("methodHttp", {
        mustHaveValue: true,
        canHaveType: false,
        canHaveName: true,
        onTagged: function(doclet, tag) {
            doclet.methodHttp = tag.value;
        }
    });
};

然后我在我的 conf.json 中添加了以下内容:
{
    "tags": {
        "allowUnknownTags": true
    },
    "source": {
        "includePattern": ".+\\.js(doc)?$",
        "excludePattern": "(^|\\/|\\\\)_"
    },
    "plugins": [ "plugins/method" ],
    "templates": {
        "cleverLinks": false,
        "monospaceLinks": false,
        "default": {
            "outputSourceFiles": true
        }
    },
    "jsVersion": 180
}

现在我尝试将这个放到我的模板上。我在 method.tmpl 上。
我尝试了:
self.find('methodHttp')[0]
data.methodHttp[0]
data.methodHttp

但它不起作用。我的代码有什么问题?
1个回答

5

jsDoc.defineTag不支持带有大写字符的标签,尽管这似乎是他们字典中的一个错误!


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接