Skip to content

Commit 4a26f57

Browse files
committed
Merge branch 'main' into dev
2 parents 270e48f + d9c980a commit 4a26f57

File tree

166 files changed

+1432
-773
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

166 files changed

+1432
-773
lines changed

.angular-github/workflows/scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,6 @@ jobs:
4747

4848
# Upload the results to GitHub's code scanning dashboard.
4949
- name: 'Upload to code-scanning'
50-
uses: github/codeql-action/upload-sarif@5d4e8d1aca955e8d8589aabd499c5cae939e33c7 # v4.31.9
50+
uses: github/codeql-action/upload-sarif@cdefb33c0f6224e58673d9004f47f7cb3e328b89 # v4.31.10
5151
with:
5252
sarif_file: results.sarif

MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ module(
55
)
66

77
bazel_dep(name = "rules_pkg", version = "1.2.0")
8-
bazel_dep(name = "rules_nodejs", version = "6.6.2")
9-
bazel_dep(name = "aspect_rules_ts", version = "3.8.1")
10-
bazel_dep(name = "aspect_rules_js", version = "2.8.3")
8+
bazel_dep(name = "rules_nodejs", version = "6.7.3")
9+
bazel_dep(name = "aspect_rules_ts", version = "3.8.3")
10+
bazel_dep(name = "aspect_rules_js", version = "2.9.1")
1111
bazel_dep(name = "aspect_rules_esbuild", version = "0.25.0")
1212
bazel_dep(name = "aspect_rules_jasmine", version = "2.0.2")
1313
bazel_dep(name = "aspect_rules_rollup", version = "2.0.1")
1414
bazel_dep(name = "bazel_skylib", version = "1.9.0")
15-
bazel_dep(name = "aspect_bazel_lib", version = "2.22.2")
15+
bazel_dep(name = "aspect_bazel_lib", version = "2.22.5")
1616
bazel_dep(name = "tar.bzl", version = "0.7.0")
1717
bazel_dep(name = "yq.bzl", version = "0.3.4")
1818
bazel_dep(name = "rules_angular")

MODULE.bazel.lock

Lines changed: 24 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

adev/package.json

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"dependencies": {
3-
"@algolia/client-common": "5.46.2",
4-
"@algolia/client-search": "5.46.2",
5-
"@algolia/requester-browser-xhr": "5.46.2",
6-
"@algolia/requester-node-http": "5.46.2",
3+
"@algolia/client-common": "5.46.3",
4+
"@algolia/client-search": "5.46.3",
5+
"@algolia/requester-browser-xhr": "5.46.3",
6+
"@algolia/requester-node-http": "5.46.3",
77
"@angular/animations": "workspace:*",
88
"@angular/aria": "21.2.0-next.0",
99
"@angular/build": "21.1.0-rc.0",
@@ -29,9 +29,9 @@
2929
"@codemirror/lang-sass": "6.0.2",
3030
"@codemirror/language": "6.12.1",
3131
"@codemirror/lint": "6.9.2",
32-
"@codemirror/search": "6.5.11",
33-
"@codemirror/state": "6.5.3",
34-
"@codemirror/view": "6.39.9",
32+
"@codemirror/search": "6.6.0",
33+
"@codemirror/state": "6.5.4",
34+
"@codemirror/view": "6.39.11",
3535
"@lezer/common": "1.5.0",
3636
"@lezer/css": "1.3.0",
3737
"@lezer/highlight": "1.2.3",
@@ -42,17 +42,17 @@
4242
"@marijn/find-cluster-break": "1.0.2",
4343
"@stackblitz/sdk": "1.11.0",
4444
"@types/dom-navigation": "1.0.6",
45-
"@types/jasmine": "5.1.13",
45+
"@types/jasmine": "5.1.15",
4646
"@types/jsdom": "27.0.0",
47-
"@types/node": "24.10.4",
47+
"@types/node": "24.10.8",
4848
"@typescript/vfs": "1.6.2",
4949
"@webcontainer/api": "1.6.1",
5050
"@xterm/addon-fit": "0.11.0",
5151
"@xterm/xterm": "6.0.0",
52-
"algoliasearch": "5.46.2",
52+
"algoliasearch": "5.46.3",
5353
"angular-split": "20.0.0",
5454
"crelt": "1.0.6",
55-
"diff": "8.0.2",
55+
"diff": "8.0.3",
5656
"emoji-regex": "10.6.0",
5757
"fflate": "0.8.2",
5858
"jasmine-core": "5.13.0",

adev/shared-docs/pipeline/shared/marked/extensions/docs-card/docs-card.mts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import {Tokens, Token, RendererThis, TokenizerThis} from 'marked';
10-
import {loadWorkspaceRelativeFile, anchorTarget} from '../../helpers.mjs';
11-
import {setInsideLink} from '../../transformations/link.mjs';
9+
import {RendererThis, Token, TokenizerThis, Tokens} from 'marked';
10+
import {anchorTarget, loadWorkspaceRelativeFile} from '../../helpers.mjs';
11+
import {AdevDocsRenderer} from '../../renderer.mjs';
1212

1313
interface DocsCardToken extends Tokens.Generic {
1414
type: 'docs-card';
@@ -67,11 +67,13 @@ export const docsCardExtension = {
6767
return undefined;
6868
},
6969
renderer(this: RendererThis, token: DocsCardToken) {
70-
return token.imgSrc ? getCardWithSvgIllustration(this, token) : getStandardCard(this, token);
70+
return token.imgSrc
71+
? getCardWithSvgIllustration(this, token)
72+
: getStandardCard(this.parser.renderer as AdevDocsRenderer, token);
7173
},
7274
};
7375

74-
function getStandardCard(renderer: RendererThis, token: DocsCardToken) {
76+
function getStandardCard(renderer: AdevDocsRenderer, token: DocsCardToken) {
7577
if (token.iconImgSrc && token.href) {
7678
// We can assume that all icons are svg files since they are custom.
7779
// We need to read svg content, instead of renering svg with `img`,
@@ -110,13 +112,11 @@ function getStandardCard(renderer: RendererThis, token: DocsCardToken) {
110112
`;
111113
}
112114

113-
function parseWithoutCreatingLinks(renderer: RendererThis, token: DocsCardToken) {
114-
setInsideLink(true);
115-
try {
116-
return renderer.parser.parse(token.tokens);
117-
} finally {
118-
setInsideLink(false);
119-
}
115+
function parseWithoutCreatingLinks(renderer: AdevDocsRenderer, token: DocsCardToken) {
116+
renderer.context.disableAutoLinking = true;
117+
const parsed = renderer.parser.parse(token.tokens);
118+
renderer.context.disableAutoLinking = false;
119+
return parsed;
120120
}
121121

122122
function getCardWithSvgIllustration(renderer: RendererThis, token: DocsCardToken) {

adev/shared-docs/pipeline/shared/marked/renderer.mts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ export interface RendererContext {
3131
apiEntries?: Record<string, {moduleName: string; aliases?: string[]}>;
3232
highlighter: HighlighterGeneric<any, any>;
3333
headerIds: Map<string, number>;
34+
/** In the case we want to disable auto-linking because anchor blocks might be incompatible where some code blocks are being rendered */
35+
disableAutoLinking: boolean;
3436
}
3537

3638
/**

adev/shared-docs/pipeline/shared/marked/test/heading/heading.spec.mts

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9-
import {parseMarkdown} from '../../parse.mjs';
10-
import {resolve} from 'node:path';
119
import {readFile} from 'fs/promises';
1210
import {JSDOM} from 'jsdom';
11+
import {resolve} from 'node:path';
12+
import {parseMarkdown} from '../../parse.mjs';
1313
import {rendererContext} from '../renderer-context.mjs';
1414

1515
describe('markdown to html', () => {
@@ -118,4 +118,17 @@ describe('markdown to html', () => {
118118

119119
expect(h2.firstElementChild!.innerHTML).toBe('Query for the <code>&lt;h1&gt;</code>');
120120
});
121+
122+
it('shoud now link symbols in headings', () => {
123+
const markdownDocument = JSDOM.fragment(
124+
parseMarkdown('## Hello **NEW** `Router` ', rendererContext),
125+
);
126+
const h2 = markdownDocument.querySelector('h2')!;
127+
128+
// The anchor element should be to only child, no nested anchor
129+
expect(h2.children.length).toBe(1);
130+
131+
// We ensure that we still style the heading content
132+
expect(markdownDocument.querySelector('strong')).toBeDefined();
133+
});
121134
});

adev/shared-docs/pipeline/shared/marked/test/renderer-context.mts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const rendererContext: RendererContext = {
2525
Router: {moduleName: 'angular/router'},
2626
},
2727
headerIds: new Map<string, number>(),
28+
disableAutoLinking: false,
2829
};
2930

3031
export async function setHighlighter() {

adev/shared-docs/pipeline/shared/marked/transformations/heading.mts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ export function headingRender(
1313
this: AdevDocsRenderer,
1414
{depth, tokens, text: headingText, raw}: Tokens.Heading,
1515
): string {
16-
const parsedText = this?.parser.parseInline(tokens);
16+
this.context.disableAutoLinking = true;
17+
const parsedText = this?.parser.parseInline(tokens, this);
18+
this.context.disableAutoLinking = false;
1719
if (depth === 1) {
1820
return `
1921
<header class="docs-header">

adev/shared-docs/pipeline/shared/marked/transformations/link.mts

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,10 @@
66
* found in the LICENSE file at https://angular.dev/license
77
*/
88

9+
import {Tokens} from 'marked';
910
import {anchorTarget} from '../helpers.mjs';
10-
import {Renderer, Tokens} from 'marked';
1111
import {AdevDocsRenderer} from '../renderer.mjs';
1212

13-
/**
14-
* Tracks whether the current renderer is inside a link.
15-
*
16-
* This is necessary because nested links are invalid HTML and can cause rendering issues.
17-
*/
18-
let insideLink = false;
19-
export function setInsideLink(value: boolean) {
20-
insideLink = value;
21-
}
22-
2313
export function linkRender(this: AdevDocsRenderer, {href, title, tokens}: Tokens.Link) {
2414
// We have render-time check that we don't create absolute links (which are rendered as external links)
2515
// in our guides
@@ -40,7 +30,7 @@ export function linkRender(this: AdevDocsRenderer, {href, title, tokens}: Tokens
4030
);
4131
}
4232

43-
if (insideLink) {
33+
if (this.context.disableAutoLinking) {
4434
return this.parser.parseInline(tokens);
4535
}
4636

0 commit comments

Comments
 (0)