How to add and use a tag on jsdoc?

穿精又带淫゛_ 提交于 2019-12-07 04:07:08

问题


I am trying to add a customTag to jsdoc. I have created a file in the plugins directory like this:

method.js

exports.defineTags = function(dictionary) {
    dictionary.defineTag("methodHttp", {
        mustHaveValue: true,
        canHaveType: false,
        canHaveName: true,
        onTagged: function(doclet, tag) {
            doclet.methodHttp = tag.value;
        }
    });
};

Then I added to my conf.json:

{
    "tags": {
        "allowUnknownTags": true
    },
    "source": {
        "includePattern": ".+\\.js(doc)?$",
        "excludePattern": "(^|\\/|\\\\)_"
    },
    "plugins": [ "plugins/method" ],
    "templates": {
        "cleverLinks": false,
        "monospaceLinks": false,
        "default": {
            "outputSourceFiles": true
        }
    },
    "jsVersion": 180
}

And now I try to get this on my template. I'm on method.tmpl.

I tried:

self.find('methodHttp')[0]
data.methodHttp[0]
data.methodHttp

But it doesn't work. What is wrong with my code?


回答1:


jsDoc.defineTag does not support tags with uppercase char...

Though it seems to be a bug in their dictionary!



来源:https://stackoverflow.com/questions/14982923/how-to-add-and-use-a-tag-on-jsdoc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!