Skip to content

fix(parse/html): astro fence#9124

Merged
ematipico merged 2 commits intomainfrom
fix/astro-fence-lexing
Feb 18, 2026
Merged

fix(parse/html): astro fence#9124
ematipico merged 2 commits intomainfrom
fix/astro-fence-lexing

Conversation

@ematipico
Copy link
Member

@ematipico ematipico commented Feb 17, 2026

Summary

Closes #8882
Closes #9108
Closes #9125

The code was generated via Claude Code. It suggested a different approach to the solution.

Test Plan

Added more tests.

Docs

@changeset-bot
Copy link

changeset-bot bot commented Feb 17, 2026

🦋 Changeset detected

Latest commit: 9ff934a

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 17, 2026
@ematipico ematipico requested review from a team February 17, 2026 11:33
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Feb 17, 2026

Walkthrough

This PR updates the Astro frontmatter lexer to reliably detect the closing --- fence when frontmatter contains comments, mixed-quote strings or escaped quotes. It adds a unified QuotesSeen state machine and QuotesSeenComment enum to track current quote, escape state and comment context; replaces ad-hoc per-quote tracking; and broadens tests covering multi-line/single-line comments, mixed quotes and escape edge cases (addresses issues #8882 and #9108). No public API changes.

Possibly related PRs

Suggested reviewers

  • dyc3
🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix(parse/html): astro fence' is concise and directly references the main change—fixing Astro frontmatter fence detection in the HTML parser.
Linked Issues check ✅ Passed The PR addresses both linked issues: #8882 (multi-line comments in frontmatter) and #9108 (unclosed quotes in strings) through lexer state machine improvements to properly track quotes and comments.
Out of Scope Changes check ✅ Passed All changes directly support the objectives: the lexer refactor handles quote/comment tracking, new test files validate the fixes, and the changeset documents the patch release.
Description check ✅ Passed The PR description clearly relates to the changeset, addressing Astro frontmatter fence detection issues with specific issue references and test additions.

✏️ 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 fix/astro-fence-lexing

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

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/biome_html_parser/src/lexer/mod.rs`:
- Around line 1505-1508: The is_empty() method currently only checks
current_quote and therefore treats being inside a comment as "empty"; update
is_empty() to also consider comment state so that being inside a comment counts
as non-empty. Specifically, modify fn is_empty(&self) -> bool in the lexer to
return true only when self.current_quote.is_none() AND whatever field tracks
comments (e.g. self.comment / self.current_comment / self.in_comment) indicates
not in a comment, so that frontmatter fences like '---' inside comments won't be
treated as closing.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 17, 2026

Merging this PR will not alter performance

✅ 4 untouched benchmarks
⏩ 152 skipped benchmarks1


Comparing fix/astro-fence-lexing (9ff934a) with main (aa40fc2)

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.

@ematipico
Copy link
Member Author

Going to merge this, let me know if there are any concerns and i will address them

@ematipico ematipico merged commit f5b0e8d into main Feb 18, 2026
18 checks passed
@ematipico ematipico deleted the fix/astro-fence-lexing branch February 18, 2026 08:52
@github-actions github-actions bot mentioned this pull request Feb 18, 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

1 participant