diff --git a/adev/shared-docs/pipeline/shared/marked/test/link/link.md b/adev/shared-docs/pipeline/shared/marked/test/link/link.md
index e8a6b828796..4003d840c7e 100644
--- a/adev/shared-docs/pipeline/shared/marked/test/link/link.md
+++ b/adev/shared-docs/pipeline/shared/marked/test/link/link.md
@@ -2,3 +2,4 @@
[same page](#test)
[same site](../other/page)
[npm packages](https://docs.npmjs.com/getting-started/what-is-npm 'What is npm?')
+[`CommonModule`](../other/page)
diff --git a/adev/shared-docs/pipeline/shared/marked/test/link/link.spec.mts b/adev/shared-docs/pipeline/shared/marked/test/link/link.spec.mts
index cc4f753f2b6..86849cf2c80 100644
--- a/adev/shared-docs/pipeline/shared/marked/test/link/link.spec.mts
+++ b/adev/shared-docs/pipeline/shared/marked/test/link/link.spec.mts
@@ -38,6 +38,10 @@ describe('markdown to html', () => {
);
});
+ it('should not auto-link a code symbol used as link text', () => {
+ expect(parsedMarkdown).toContain('CommonModule');
+ });
+
it('should throw if on absolute links to adev', async () => {
try {
parsedMarkdown = await parseMarkdown(
diff --git a/adev/shared-docs/pipeline/shared/marked/transformations/link.mts b/adev/shared-docs/pipeline/shared/marked/transformations/link.mts
index d01b65abf6c..393c369c1db 100644
--- a/adev/shared-docs/pipeline/shared/marked/transformations/link.mts
+++ b/adev/shared-docs/pipeline/shared/marked/transformations/link.mts
@@ -35,5 +35,12 @@ export function linkRender(this: AdevDocsRenderer, {href, title, tokens}: Tokens
}
const titleAttribute = title ? ` title="${title}"` : '';
- return `${this.parser.parseInline(tokens)}`;
+ // Disable auto-linking while rendering the link's content so that a code symbol used as the
+ // link text (e.g. [`httpResource`](/guide/http/http-resource)) isn't turned into a nested
+ // anchor pointing at the API reference, which would override the explicit link.
+ const previousDisableAutoLinking = this.context.disableAutoLinking;
+ this.context.disableAutoLinking = true;
+ const content = this.parser.parseInline(tokens);
+ this.context.disableAutoLinking = previousDisableAutoLinking;
+ return `${content}`;
}