javascript - Is it possible to add tags to JSDoc? -
i using meteor has odd caveats compared normal javascript. want add tags in order make documentation more explicit.
meteor.methods({ /** * upgrade user's role * * @where anywhere * @rolerequired 'admin' * * @module meteor.methods * @method roles.upgrade * @param {string|object} user userid or user document update * @param {string} role role add user * @throws meteor.error 401 if user trying upgrade not authorized * * @example * meteor.call('roles.upgrade', meteor.users.findone(), function (err) { if (!err) { console.log('user added role'); } else { router.error(401); } }) */ 'roles.upgrade': function (user, role) { if (roles.userisinrole(this.userid, 'admin')) { return roles.addusertoroles(user, role); } else { throw new meteor.error(401, "not authorized upgrade roles") } } });
the @where
, @rolerequired
more specific meteor based application. @where
can seen in devdocs.io.
is possible add tags jsdoc?
yes, possible add custom tags jsdoc. need create javascript file defines tags want add:
custom_tags.js exports.definetags = function(dictionary) { dictionary.definetag('where', { musthavevalue: true, ontagged : function(doclet, tag) { doclet.where = doclet.where || []; doclet.where.push(tag.value); } }); };
then need add location javascript file conf.json has plugin listed part of path
conf.json { "plugins": [ "plugins/test" ], }
finally need update .tmpl file default templates render information in generated documents. or can create own template , define own parse add tags generated documentation.
Comments
Post a Comment