mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
fix(docs-infra): stop auto-linking "state" and "group" to APIs
Prevents common words used in code examples from being incorrectly linked to API references. Fixes: #66292
This commit is contained in:
committed by
Kirill Cherkashin
parent
5d3708e5ed
commit
8358e548ce
@@ -18,6 +18,8 @@ const LINK_EXEMPT = new Set([
|
||||
'readonly',
|
||||
'disabled',
|
||||
'hidden',
|
||||
'state',
|
||||
'group',
|
||||
]);
|
||||
|
||||
export function shouldLinkSymbol(symbol: string): boolean {
|
||||
|
||||
@@ -6,3 +6,9 @@ this is code
|
||||
<docs-code path="./example-with-region.ts" />
|
||||
|
||||
<docs-code header="src/locale/messages.fr.xlf (<trans-unit>)" path="./messages.fr.xlf" />
|
||||
|
||||
<docs-code header="Property names should not be linked" language="ts">
|
||||
const form = {
|
||||
state: ['']
|
||||
};
|
||||
</docs-code>
|
||||
|
||||
@@ -47,4 +47,9 @@ describe('markdown to html', () => {
|
||||
const codeBlock = markdownDocument.querySelectorAll('code')[3];
|
||||
expect(codeBlock).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should not link property names in object literals', () => {
|
||||
const codeBlock = markdownDocument.querySelectorAll('code')[4];
|
||||
expect(codeBlock?.innerHTML).not.toContain('<a href="/api/animations/state">state</a>');
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user