build(aio): do not try to auto-link to internal API items (#24000)
This would cause dangling links since the target, being internal, would not exist in the docs. PR Close #24000
This commit is contained in:
parent
5fb0b567ce
commit
131d0d8e8a
|
@ -65,7 +65,9 @@ module.exports = function autoLinkCode(getDocFromAlias) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
function foundValidDoc(docs) {
|
function foundValidDoc(docs) {
|
||||||
return docs.length === 1 && autoLinkCodeImpl.docTypes.indexOf(docs[0].docType) !== -1;
|
return docs.length === 1 &&
|
||||||
|
!docs[0].internal &&
|
||||||
|
autoLinkCodeImpl.docTypes.indexOf(docs[0].docType) !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function createLinkNode(doc, text) {
|
function createLinkNode(doc, text) {
|
||||||
|
|
|
@ -79,6 +79,13 @@ describe('autoLinkCode post-processor', () => {
|
||||||
'</code>');
|
'</code>');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should ignore code items that match an internal API doc', () => {
|
||||||
|
aliasMap.addDoc({ docType: 'class', id: 'MyClass', aliases: ['MyClass'], path: 'a/b/myclass', internal: true });
|
||||||
|
const doc = { docType: 'test-doc', renderedContent: '<code>MyClass</code>' };
|
||||||
|
processor.$process([doc]);
|
||||||
|
expect(doc.renderedContent).toEqual('<code>MyClass</code>');
|
||||||
|
});
|
||||||
|
|
||||||
it('should insert anchors for individual text nodes within a code block', () => {
|
it('should insert anchors for individual text nodes within a code block', () => {
|
||||||
aliasMap.addDoc({ docType: 'class', id: 'MyClass', aliases: ['MyClass'], path: 'a/b/myclass' });
|
aliasMap.addDoc({ docType: 'class', id: 'MyClass', aliases: ['MyClass'], path: 'a/b/myclass' });
|
||||||
const doc = { docType: 'test-doc', renderedContent: '<code><span>MyClass</span><span>MyClass</span></code>' };
|
const doc = { docType: 'test-doc', renderedContent: '<code><span>MyClass</span><span>MyClass</span></code>' };
|
||||||
|
|
Loading…
Reference in New Issue