Search code examples
node.jsjsdoc

Exclude Externals from jsDoc output


How can we exclude Externals section from jsDoc output correctly?

I have lots of externals in my project that I do not want to show on the navigation panel at all, as it takes up all the space, and is useless to us.

I have been able to hack it manually, by changing the code in file node_modules\jsdoc\lib\util\templateHelper.js, but this is not a reusable approach for my team of developers.

The hack was in overriding members.externals with an empty array:

/*
    members.externals = members.externals.map(function(doclet) {
        doclet.name = doclet.name.replace(/(^"|"$)/g, '');
        return doclet;
    });
*/
    members.externals = [];

Solution

  • Unfortunately, after years of using jsDoc, all I can do is to continue re-hacking it after every update of the dependency, in file node_modules\jsdoc\lib\util\templateHelper.js.

    Fortunately, even with the current version 3.5.5, the hack still works the same:

    // HACK: set Externals to an empty list:
    members.externals = []; /*members.externals.map(function(doclet) {
        doclet.name = doclet.name.replace(/(^"|"$)/g, '');
    
        return doclet;
    });*/