jsdoc2md / dmd

The default output template for jsdoc2md
MIT License
39 stars 49 forks source link

exported module function does not include members #7

Closed alexmingoia closed 9 years ago

alexmingoia commented 9 years ago
/**
 * @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.

75lb commented 9 years ago

hi @alexmingoia .. i think you have encountered this jsdoc bug https://github.com/jsdoc3/jsdoc/issues/679

75lb commented 9 years ago

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

75lb commented 9 years ago

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;
75lb commented 9 years ago

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

alexmingoia commented 9 years ago

The next version looks great! :+1:

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.

75lb commented 9 years ago

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 :)