Skip to content

Disambiguate whitespace-preceded ">" in HTML attributes - #234

Merged
DylanPiercey merged 2 commits into
mainfrom
dpiercey-ws-marko-trailing-bracket-8aqu7u
Aug 7, 2026
Merged

Disambiguate whitespace-preceded ">" in HTML attributes#234
DylanPiercey merged 2 commits into
mainfrom
dpiercey-ws-marko-trailing-bracket-8aqu7u

Conversation

@DylanPiercey

@DylanPiercey DylanPiercey commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

In HTML mode a > after an unenclosed attribute always closed the tag, so <if=count > 10> silently parsed as <if=count> followed by the text 10> — a chronic trap since both readings are valid. The parser now looks ahead when an attribute ends at whitespace followed by >: if the rest of the line has the shape of a split comparison ending in a > that hugs its final operand (10>, x.length>, 10 && flag/>), it reports an error telling the author to either parenthesize the expression or remove the whitespace before the tag-closing >. Anything the look-ahead does not recognize keeps the existing behavior, so ordinary content like <div class=foo > Hello</div> is unaffected.

Whitespace-preceded >= is now parsed as a comparison operator (matching <=), since a tag close can never be followed by a hugging =.

Additionally, a whitespace-preceded </ after an unenclosed attribute value is now treated as a close tag instead of being consumed as a less-than operand (previously <div class=x + y </div> swallowed the close tag into the value and reported a misleading Missing ending "div" tag); a close tag found before the open tag is completed now reports a targeted error suggesting parentheses. Genuine less-than comparisons (a < b, a < /re/.test(c)) are unaffected.

@changeset-bot

changeset-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 2e5d2d0

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

This PR includes changesets to release 1 package
Name Type
htmljs-parser Minor

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

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 12 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 07ebcf2f-3cb6-4452-b6e7-5705cf1088b4

📥 Commits

Reviewing files that changed from the base of the PR and between 1377b11 and 2e5d2d0.

⛔ Files ignored due to path filters (24)
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-arrow/__snapshots__/attr-ambiguous-right-angle-bracket-arrow.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-bare-equal/__snapshots__/attr-ambiguous-right-angle-bracket-bare-equal.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-eof/__snapshots__/attr-ambiguous-right-angle-bracket-eof.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-grouped/__snapshots__/attr-ambiguous-right-angle-bracket-grouped.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-index-division/__snapshots__/attr-ambiguous-right-angle-bracket-index-division.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-logical/__snapshots__/attr-ambiguous-right-angle-bracket-logical.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-name/__snapshots__/attr-ambiguous-right-angle-bracket-name.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-nested-gte/__snapshots__/attr-ambiguous-right-angle-bracket-nested-gte.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-regex/__snapshots__/attr-ambiguous-right-angle-bracket-regex.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-self-close/__snapshots__/attr-ambiguous-right-angle-bracket-self-close.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-string/__snapshots__/attr-ambiguous-right-angle-bracket-string.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-trailing-space/__snapshots__/attr-ambiguous-right-angle-bracket-trailing-space.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-unbalanced-group/__snapshots__/attr-ambiguous-right-angle-bracket-unbalanced-group.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-unmatched-close/__snapshots__/attr-ambiguous-right-angle-bracket-unmatched-close.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket/__snapshots__/attr-ambiguous-right-angle-bracket.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-close-tag-in-unenclosed-value/__snapshots__/attr-close-tag-in-unenclosed-value.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-less-than-regex/__snapshots__/attr-less-than-regex.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-less-than/__snapshots__/attr-less-than.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-operators-newline-after/__snapshots__/attr-operators-newline-after.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-operators-newline-before/__snapshots__/attr-operators-newline-before.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-operators-space-before/__snapshots__/attr-operators-space-before.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-operators-space-between/__snapshots__/attr-operators-space-between.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-right-angle-bracket-gte/__snapshots__/attr-right-angle-bracket-gte.expected.txt is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/attr-with-right-angle-bracket-whitespace/__snapshots__/attr-with-right-angle-bracket-whitespace.expected.txt is excluded by !**/__snapshots__/** and included by **
📒 Files selected for processing (31)
  • .changeset/close-tag-less-than.md
  • .changeset/quiet-pears-refuse.md
  • agent-feedback/bugs.md
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-arrow/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-bare-equal/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-eof/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-grouped/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-index-division/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-logical/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-name/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-nested-gte/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-regex/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-self-close/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-string/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-trailing-space/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-unbalanced-group/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket-unmatched-close/input.marko
  • src/__tests__/fixtures/attr-ambiguous-right-angle-bracket/input.marko
  • src/__tests__/fixtures/attr-close-tag-in-unenclosed-value/input.marko
  • src/__tests__/fixtures/attr-less-than-regex/input.marko
  • src/__tests__/fixtures/attr-less-than/input.marko
  • src/__tests__/fixtures/attr-operators-newline-after/input.marko
  • src/__tests__/fixtures/attr-operators-newline-before/input.marko
  • src/__tests__/fixtures/attr-operators-space-before/input.marko
  • src/__tests__/fixtures/attr-operators-space-between/input.marko
  • src/__tests__/fixtures/attr-right-angle-bracket-gte/input.marko
  • src/__tests__/fixtures/attr-with-right-angle-bracket-whitespace/input.marko
  • src/states/ATTRIBUTE.ts
  • src/states/EXPRESSION.ts
  • src/util/error-code.ts
  • src/util/util.ts

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

@codecov

codecov Bot commented Aug 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.95%. Comparing base (1377b11) to head (2e5d2d0).

Additional details and impacted files
@@           Coverage Diff            @@
##             main     #234    +/-   ##
========================================
  Coverage   99.95%   99.95%            
========================================
  Files          34       34            
  Lines        4270     4466   +196     
  Branches      793      853    +60     
========================================
+ Hits         4268     4464   +196     
  Misses          2        2            

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@DylanPiercey
DylanPiercey force-pushed the dpiercey-ws-marko-trailing-bracket-8aqu7u branch from 42b2e1e to 6c0c436 Compare August 7, 2026 15:58
@DylanPiercey
DylanPiercey merged commit c2e874c into main Aug 7, 2026
11 checks passed
@DylanPiercey
DylanPiercey deleted the dpiercey-ws-marko-trailing-bracket-8aqu7u branch August 7, 2026 16:14
@github-actions github-actions Bot mentioned this pull request Aug 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant