jsdoc2md / dmd

The default output template for jsdoc2md

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

exported module function does not include members

alexmingoia opened this issue · comments

/**
 * @module myModule
 */

module.exports = function foo () { ... }

exports.bar = function () { ... }
{
    "params": [],
    "name": "bar",
    "longname": "module:myModule.bar",
    "kind": "function",
    "memberof": "module:myModule",
    "scope": "static",
    "codeName": "exports.bar"
  },

exports.bar is missing from the generated docs... but seems to be parsed correctly in the output of jsdoc-parse. I'll investigate further if I have time. Exporting a class doesn't present this problem.

hi @alexmingoia .. i think you have encountered this jsdoc bug jsdoc/jsdoc#679

i will try to reproduce your issue asap and offer some suggestions

Hi, i'm back.. sorry for delay.. so, yes - it's a jsdoc bug.. this is how i workaround it for modules which export a function:

/**
this module exports a function to add two numbers
@module sum-ting
*/
module.exports = sum;

/**
the function
@param {number} - the first number
@param {number} - the second number
@returns {number} the calculation result
@alias module:sum-ting
*/
function sum(one, two){};

/**
an additional static property
*/
sum.sumthingStatic = 1;

hi @alexmingoia , can you point me to the project you are having this issue with so i can reproduce it for myself?

meanwhile, i tested the next version of jsdoc2md on one of your projects, how does it look? https://github.com/75lb/asserted

The next version looks great! 👍

Thanks for looking into this. I'm using the workaround you suggested. I'm actually using jdoc2md for all my projects where I can. I have a node/browser scaffolding module I use that I've incorporated jsdoc2md into: slush-js-skeleton.

sup alex.. i packaged up a pre-release version for you to play with..

install it
$ npm install -g jsdoc-to-markdown@next

then try it for yourself, on say asserted:
$ jsdoc2md -t lib/readme.hbs lib/asserted.js > README.md

take a look at the new options:
$ jsdoc2md --help

let me know of any flaws etc :)