Skip to content

fix(parse/html): don't lex square brackets as special tokens in contexts where they don't mean anything#9150

Merged
dyc3 merged 2 commits intomainfrom
dyc3/fix-html-square-bracket-parse
Feb 20, 2026
Merged

fix(parse/html): don't lex square brackets as special tokens in contexts where they don't mean anything#9150
dyc3 merged 2 commits intomainfrom
dyc3/fix-html-square-bracket-parse

Conversation

@dyc3
Copy link
Copy Markdown
Contributor

@dyc3 dyc3 commented Feb 19, 2026

Summary

fixes #9138
fixes #8336

planned by sonnet 4.6 and generated by kimi k2.5

Test Plan

added snapshots

Docs

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Feb 19, 2026

🦋 Changeset detected

Latest commit: 6946835

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 13 packages
Name Type
@biomejs/biome Patch
@biomejs/cli-win32-x64 Patch
@biomejs/cli-win32-arm64 Patch
@biomejs/cli-darwin-x64 Patch
@biomejs/cli-darwin-arm64 Patch
@biomejs/cli-linux-x64 Patch
@biomejs/cli-linux-arm64 Patch
@biomejs/cli-linux-x64-musl Patch
@biomejs/cli-linux-arm64-musl Patch
@biomejs/wasm-web Patch
@biomejs/wasm-bundler Patch
@biomejs/wasm-nodejs Patch
@biomejs/backend-jsonrpc Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions Bot added A-Parser Area: parser L-HTML Language: HTML and super languages labels Feb 19, 2026
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Feb 19, 2026

Walkthrough

Adds lexer and parser plumbing to stop treating [ and ] as special tokens and to gate frontmatter fence (---) recognition after an Astro frontmatter block. Introduces after_frontmatter flag on the lexer/token source and a setter on the parser; the lexer only emits a FENCE for --- when after_frontmatter is false. Removes BTO/BTC handling in relevant contexts. Adds test fixtures for Astro, Vue, Svelte and plain HTML and two changeset entries documenting the fixes and patch release notes for issue #9138.

Possibly related PRs

Suggested reviewers

  • ematipico
  • chansuke
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: fixing the HTML parser to stop treating square brackets as special tokens in regular text contexts.
Linked Issues check ✅ Passed The PR fully addresses issue #9138 by removing bracket token handling in Regular and InsideTagDirectives contexts, allowing square brackets to be parsed as plain text.
Out of Scope Changes check ✅ Passed All changes are tightly scoped: lexer/parser updates for bracket handling, test cases demonstrating the fix across Astro/HTML/Vue/Svelte, and changesets documenting the fixes.
Description check ✅ Passed The description clearly addresses the pull request's purpose: fixing issues #9138 and #8336 by improving HTML parser handling of square brackets and frontmatter fences.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch dyc3/fix-html-square-bracket-parse

Comment @coderabbitai help to get the list of available commands and usage tips.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq Bot commented Feb 19, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 152 skipped benchmarks1


Comparing dyc3/fix-html-square-bracket-parse (6946835) with main (8ca3f7f)

Open in CodSpeed

Footnotes

  1. 152 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

Copy link
Copy Markdown
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we have the same issue for ---, mind fixing it here? It wasn't filed as an issue, but a user left a comment about it

@dyc3
Copy link
Copy Markdown
Contributor Author

dyc3 commented Feb 19, 2026

I think somebody did post an issue about it actually

edit: yup found it: #8336

…n astro frontmatter or when there is no actual frontmatter
Copy link
Copy Markdown
Contributor Author

dyc3 commented Feb 20, 2026

Merge activity

  • Feb 20, 12:19 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 20, 12:20 PM UTC: @dyc3 merged this pull request with Graphite.

@dyc3 dyc3 merged commit 33b8f40 into main Feb 20, 2026
19 checks passed
@dyc3 dyc3 deleted the dyc3/fix-html-square-bracket-parse branch February 20, 2026 12:20
@github-actions github-actions Bot mentioned this pull request Feb 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Parser Area: parser L-HTML Language: HTML and super languages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

📝 Error while parsing brackets in HTML 🐛 Horizontal lines in HTML cause an error during parsing: Unexpected value or character

2 participants