Closed elementbound closed 2 months ago
Looks like the issue could be that "memberof" is set to the same as "id" in the class item in the jsdoc template data when you have a constructor. This workaround seems to work for us:
Use:
const data = (await jsdoc2md.getTemplateData({files: source})).map(item => {
if (item.memberof === item.id) {
delete item.memberof;
}
return item;
});
const md = await jsdoc2md.render({data});
Instead of:
const md = await jsdoc2md.render({files: source});
Add this to the top of the file:
/**
* @module my-module-name
*/
It's because the documented classes are children (in the underlying data structure) of an undocumented module. Undocumented identifiers/modules are skipped, resulting in their children being skipped too. See this.
I need to make this behaviour more clear in the docs as it's by far the most common cause of confusion.
The issue is reproducible on the nlon repo, by running jsdoc2md against packages/nlon/lib/error.mjs, it produces the following output:
The output contains only one class, while the file itself contains multiple. The only thing I've noticed is that
PeerDisconnectedError
has no constructor, while the rest of the classes do. If I pick a class and remove its constructor, the class appears in the output as well.Note that using the --json switch results in info about all the symbols ( not included for brewity ).
Here's the exact commands to replicate, starting from the root of the repo:
Excellent tool otherwise! Unfortunately this is a deal-breaker for me at the moment, but looking forward to using this in the future.