fix: incorrect whitespace removal in concise mode html blocks#216
fix: incorrect whitespace removal in concise mode html blocks#216DylanPiercey merged 1 commit intomainfrom
Conversation
🦋 Changeset detectedLatest commit: 1118b07 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
WalkthroughThis pull request addresses a regression in the htmljs-parser where whitespace was incorrectly removed in concise mode HTML blocks. The fix includes a patch release changelog entry, a new test fixture file for mixed block root scenarios, and a modification to the delimiter HTML block state handler that enables proper text parsing after multiline delimited HTML block endings by starting a new text segment when appropriate conditions are met. 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
src/__tests__/fixtures/mixed-block-root/input.marko (1)
1-11: Consider adding one fixture that mirrors the exact self-closing repro.This mixed-root fixture is good, but a minimal
--- <a/> <b/> <c/> ---case would guard the precise regression described in the PR.Suggested additional fixture
+// src/__tests__/fixtures/concise-html-block-self-closing/input.marko +--- +<a/> +<b/> +<c/> +---🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@src/__tests__/fixtures/mixed-block-root/input.marko` around lines 1 - 11, Add a new minimal fixture that reproduces the self-closing regression alongside the existing mixed-block-root fixture: create a test fixture (e.g., under src/__tests__/fixtures/self-closing-root/) containing a single document with the exact self-closing pattern `--- <a/> <b/> <c/> ---` so the parser is exercised on three adjacent self-closing tags; ensure the new fixture filename and content follow the same layout conventions as src/__tests__/fixtures/mixed-block-root/input.marko so it is picked up by the test runner.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@src/__tests__/fixtures/mixed-block-root/input.marko`:
- Around line 1-11: Add a new minimal fixture that reproduces the self-closing
regression alongside the existing mixed-block-root fixture: create a test
fixture (e.g., under src/__tests__/fixtures/self-closing-root/) containing a
single document with the exact self-closing pattern `--- <a/> <b/> <c/> ---` so
the parser is exercised on three adjacent self-closing tags; ensure the new
fixture filename and content follow the same layout conventions as
src/__tests__/fixtures/mixed-block-root/input.marko so it is picked up by the
test runner.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
src/__tests__/fixtures/argument-tag-nested-parens/__snapshots__/argument-tag-nested-parens.expected.txtis excluded by!**/__snapshots__/**and included by**src/__tests__/fixtures/mixed-block-root/__snapshots__/mixed-block-root.expected.txtis excluded by!**/__snapshots__/**and included by**src/__tests__/fixtures/multiline-html-block/__snapshots__/multiline-html-block.expected.txtis excluded by!**/__snapshots__/**and included by**src/__tests__/fixtures/open-tag-only-with-body/__snapshots__/open-tag-only-with-body.expected.txtis excluded by!**/__snapshots__/**and included by**
📒 Files selected for processing (3)
.changeset/metal-bobcats-bathe.mdsrc/__tests__/fixtures/mixed-block-root/input.markosrc/states/BEGIN_DELIMITED_HTML_BLOCK.ts
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #216 +/- ##
==========================================
+ Coverage 91.98% 92.00% +0.01%
==========================================
Files 28 28
Lines 1448 1450 +2
Branches 327 328 +1
==========================================
+ Hits 1332 1334 +2
Misses 54 54
Partials 62 62 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Fixes a regression caused by #199 which incorrectly trimmed concise mode html block newlines between nodes (should have just been leading / trailing whitespace for the block.
Eg
Would yield
<a/>,<b/>,<c/>, instead of<a/>\n,<b/>\n,<c/>.