Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add and use a tag on jsdoc?

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?

like image 766
kavaliero Avatar asked Oct 04 '22 23:10

kavaliero


1 Answers

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

Though it seems to be a bug in their dictionary!

like image 158
bumpmann Avatar answered Oct 10 '22 01:10

bumpmann