【问题标题】:How to add and use a tag on jsdoc?如何在 jsdoc 上添加和使用标签?
【发布时间】:2015-12-17 17:11:53
【问题描述】:

我正在尝试将 customTag 添加到 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

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

【问题讨论】:

    标签: javascript jsdoc


    【解决方案1】:

    jsDoc.defineTag 不支持带有大写字符的标签...

    虽然这似乎是他们字典中的错误!

    【讨论】:

      猜你喜欢
      • 2015-10-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-24
      • 1970-01-01
      相关资源
      最近更新 更多