diff --git a/.github/workflows/lighthouse-report.yml b/.github/workflows/lighthouse-report.yml index 62abdc1dc20c..0a2cd8933cde 100644 --- a/.github/workflows/lighthouse-report.yml +++ b/.github/workflows/lighthouse-report.yml @@ -68,6 +68,7 @@ jobs: - name: Add Lighthouse stats as comment id: comment_to_pr + if: ${{ github.event.pull_request.head.repo.fork == false }} uses: marocchino/sticky-pull-request-comment@5770ad5eb8f42dd2c4f34da00c94c5381e49af88 # 3.0.5 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/examples/classic-typescript/package.json b/examples/classic-typescript/package.json index 85199e550e01..f8dbff6b126f 100644 --- a/examples/classic-typescript/package.json +++ b/examples/classic-typescript/package.json @@ -45,7 +45,7 @@ ] }, "engines": { - "node": ">=20.0" + "node": ">=24.14" }, "description": "Docusaurus example project (classic-typescript template)" } diff --git a/examples/classic/package.json b/examples/classic/package.json index e535f4f52790..fee42aadc57d 100644 --- a/examples/classic/package.json +++ b/examples/classic/package.json @@ -41,7 +41,7 @@ ] }, "engines": { - "node": ">=20.0" + "node": ">=24.14" }, "description": "Docusaurus example project" } diff --git a/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts b/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts index a81e8cfff103..1ec41d90a455 100644 --- a/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts +++ b/packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts @@ -47,6 +47,47 @@ describe('createExcerpt', () => { ); }); + it('creates excerpt for h1 heading containing hash in text (e.g. C#)', () => { + expect( + createExcerpt(dedent` + + # C# Programming Guide + + This paragraph should become the description. + `), + ).toBe('This paragraph should become the description.'); + }); + + it('creates excerpt for h1 heading containing hash in text (e.g. F#)', () => { + expect( + createExcerpt(dedent` + + # F# Programming Guide + + This paragraph should become the description. + `), + ).toBe('This paragraph should become the description.'); + }); + + it('creates excerpt for h1 heading containing hash with trailing ATX closing marker', () => { + expect( + createExcerpt(dedent` + + # C# Programming Guide # + + This paragraph should become the description. + `), + ).toBe('This paragraph should become the description.'); + }); + + it('creates excerpt for h2 heading containing hash in text (e.g. C#)', () => { + expect( + createExcerpt(dedent` + ## C# Setup Guide + `), + ).toBe('C# Setup Guide'); + }); + it('creates excerpt for regular content with alternate title', () => { expect( createExcerpt(dedent` diff --git a/packages/docusaurus-utils/src/markdownUtils.ts b/packages/docusaurus-utils/src/markdownUtils.ts index 216d0122e7ad..7857c0fc6f03 100644 --- a/packages/docusaurus-utils/src/markdownUtils.ts +++ b/packages/docusaurus-utils/src/markdownUtils.ts @@ -146,7 +146,7 @@ export function createExcerpt(fileString: string): string | undefined { // Remove HTML tags. .replace(/<[^>]*>/g, '') // Remove Title headers - .replace(/^#[^#]+#?/gm, '') + .replace(/^#(?!#).*/gm, '') // Remove Markdown + ATX-style headers .replace(/^#{1,6}\s*(?[^#]*?)\s*#{0,6}/gm, '$1') // Remove emphasis.