Pete Bacon Darwin e7b392bf3a build(aio): improve automatic linking of code items (#24000)
This commit adds new link disambiguators that mean that more
code links can be generated automatically in a sensible way.

The best example is the use of properties within class, interface and
enum documentation.

PR Close #24000
2018-06-13 16:47:40 -07:00

15 lines
614 B
JavaScript

/**
* This link disambiguator will remove all the members from the list of ambiguous links
* if there is at least one link to a doc that is not a member.
*
* The heuristic is that exports are more important than members when linking, and that
* in general members will be linked to via a more explicit code links such as
* `MyClass.member` rather than simply `member`.
*/
module.exports = function disambiguateByNonMember() {
return (alias, originatingDoc, docs) => {
const filteredDocs = docs.filter(doc => doc.docType !== 'member');
return filteredDocs.length > 0 ? filteredDocs : docs;
};
};