Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing documentation for classes with constructors #290

Open
elementbound opened this issue Mar 13, 2023 · 1 comment
Open

Missing documentation for classes with constructors #290

elementbound opened this issue Mar 13, 2023 · 1 comment

Comments

@elementbound
Copy link

The issue is reproducible on the nlon repo, by running jsdoc2md against packages/nlon/lib/error.mjs, it produces the following output:

<a name="PeerDisconnectedError"></a>

## PeerDisconnectedError
<p>Error thrown when trying to send / receive on a peer that's already
disconnected.</p>

**Kind**: global class  

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:

cd packages/nlon
jsdoc2md -c .jsdoc.js lib/error.mjs
jsdoc2md -c .jsdoc.js lib/error.mjs --json

Excellent tool otherwise! Unfortunately this is a deal-breaker for me at the moment, but looking forward to using this in the future.

@krisha2
Copy link

krisha2 commented Jul 4, 2023

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});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants