Skip to content

fix(utils): skip h1 headings with hashes in excerpts - #12306

Open
cyphercodes wants to merge 1 commit into
facebook:mainfrom
cyphercodes:fix-meta-description-hash-heading
Open

fix(utils): skip h1 headings with hashes in excerpts#12306
cyphercodes wants to merge 1 commit into
facebook:mainfrom
cyphercodes:fix-meta-description-hash-heading

Conversation

@cyphercodes

Copy link
Copy Markdown
Contributor

Fixes #12305

Motivation

Docusaurus skips H1 headings when deriving automatic page descriptions, but the H1-stripping regex stopped at an additional # inside heading text like C# or F#. That left the rest of the heading as the generated description.

Test Plan

  • pnpm vitest run packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts
  • pnpm exec eslint packages/docusaurus-utils/src/markdownUtils.ts packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts
  • pnpm exec oxfmt --check packages/docusaurus-utils/src/markdownUtils.ts packages/docusaurus-utils/src/__tests__/markdownUtils.test.ts
  • git diff --check

Environment note: local Node is v22.22.2; repo packages warn they prefer >=24.14, but the targeted tests/lint/format checks passed.

@meta-cla meta-cla Bot added the CLA Signed Signed Facebook CLA label Jul 22, 2026
@netlify

netlify Bot commented Jul 22, 2026

Copy link
Copy Markdown

[V2]

Built without sensitive environment variables

Name Link
🔨 Latest commit 83e4a17
🔍 Latest deploy log https://app.netlify.com/projects/docusaurus-2/deploys/6a60385f34edaf00082f8bcc
😎 Deploy Preview https://deploy-preview-12306--docusaurus-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Auto-generated meta description is incorrect when an H1 heading contains # in its text (e.g. C#, F#)

1 participant