feat: trim whitespace from concise mode fences#199
Conversation
🦋 Changeset detectedLatest commit: 58bf756 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 |
367f4e6 to
91983f0
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #199 +/- ##
==========================================
+ Coverage 91.87% 91.96% +0.09%
==========================================
Files 28 28
Lines 1427 1443 +16
Branches 323 327 +4
==========================================
+ Hits 1311 1327 +16
Misses 54 54
Partials 62 62 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
WalkthroughAdds a changeset for htmljs-parser documenting concise-mode trimming of boundary newlines and leading indentation. Parser.ts now avoids emitting empty text events at EndText. BEGIN_DELIMITED_HTML_BLOCK refactors delimited HTML block end-of-line and indentation handling, adjusts cursor advancement, whitespace trimming, and text-boundary start/end logic via a new 🚥 Pre-merge checks | ✅ 3 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 Tip Issue Planner is now in beta. Read the docs and try it out! Share your feedback on Discord. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@src/states/BEGIN_DELIMITED_HTML_BLOCK.ts`:
- Around line 98-102: The close-delimiter branch currently calls
parser.endText() while leaving any trailing spaces before the newline untouched;
update the delimiter-close path (the block that checks
parser.lookAheadFor(endHtmlBlockLookahead, parser.pos + newLineLength)) to trim
trailing whitespace before ending the text, mirroring the dedent path behavior:
scan backwards from parser.pos to remove spaces/tabs (or adjust parser.pos) so
trailing boundary whitespace is excluded, then call parser.endText(), update
parser.pos by newLineLength + endHtmlBlockLookahead.length, and set
parser.forward = 0; ensure you use the same trimming logic used by the dedent
path to keep behavior consistent.
91983f0 to
58bf756
Compare
In previous versions of this parser, concise mode code fences preserved their leading and trailing whitespace
These changes trim that whitespace, and also whitespace from leading tabs