jsdoc2md / jsdoc-to-markdown

Generate markdown documentation from jsdoc-annotated javascript
MIT License
1.68k stars 152 forks source link

module with multiple classes outputs multiples of the same function #184

Open mlg-rbalhorn opened 5 years ago

mlg-rbalhorn commented 5 years ago

I have a module with multiple exported classes Each class is in its own file in the libs folder. I consider them separate modules as but combined into one as they are related and some scripts only need 2 or 3 of the classes etc. anyway...

I have a template set up with the API output as such:

{{#modules}}
### {{name}}
{{description}}
{{>body~}}
{{#functions}}
####{{../typicalname}}.{{name}}(params)
{{description}}
{{>body~}}
{{/functions}}
{{/modules}}

When I export jsdoc2md --template ./README.hbs ./libs/*.js > ./README.md

I get the a loop of all functions from all pages put out the number of pages.

eg.

module1.function 1 module1.function 2 module1.function 3 module2.function 1 module2.function 2 module2.function 3 module3.function1 module4.function1 module1.function 1 module1.function 2 module1.function 3 module2.function 1 module2.function 2 module2.function 3 module3.function1 module4.function1 module1.function 1 module1.function 2 module1.function 3 module2.function 1 module2.function 2 module2.function 3 module3.function1 module4.function1 module1.function 1 module1.function 2 module1.function 3 module2.function 1 module2.function 2 module2.function 3 module3.function1 module4.function1

so in otherwords, its ouputting all the functions from all pages for each script so I get 4 duplicates as it sees them as a single module. I am not sure how to fix this.

Obviously, what I need is:

module1.function 1 module1.function 2 module1.function 3 module2.function 1 module2.function 2 module2.function 3 module3.function1 module4.function1

mlg-rbalhorn commented 5 years ago

also, even if I reduce the template to just:

{{#functions}}
####{{../typicalname}}.{{name}}(params)
{{/functions}}

I still get:

function 1
function 2
function 3
function 1
function 2
function 3
function1
function1
function 1
function 2
function 3
function 1
function 2
function 3
function1
function1
function 1
function 2
function 3
function 1
function 2
function 3
function1
function1
function 1
function 2
function 3
function 1
function 2
function 3
function1
function1
75lb commented 3 years ago

could you post some dummy input files I could use to reproduce this?

Abdilar commented 8 months ago

use --files flag. like this:

./node_modules/jsdoc-to-markdown/bin/cli.js --configure .jsdoc.json --files src > API.md

It's worked for me