Skip to content

fix: escape only the text backslashes that border a placeholder - #151

Merged
DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-prettier-marko-async-ulp3vg-text-backslashes
Sep 23, 2026
Merged

DylanPiercey merged 1 commit into
mainfrom
dpiercey-ws-prettier-marko-async-ulp3vg-text-backslashes

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

The Text printer doubled every backslash in text content, but htmljs-parser only reads a backslash run as escapes right before ${ or $!{, so each format changed what rendered and grew the run again (C:\Users → C:\\Users → C:\\\\Users), and prettier --check could never pass on such a file. Text is now escaped with htmljs-parser 5.16's escapeText, given the content that follows it, which also covers the visible space printed for trailing whitespace. This fixes the text-backslash-doubling agent-feedback item, whose fixture ran as an expected failure without a JS parser and now passes.

🤖 Generated with Claude Code

htmljs-parser only reads a backslash run as escapes right before `${` or
`$!{`, so doubling every backslash in text changed what rendered and grew on
each format. Text is now escaped with htmljs-parser's `escapeText`, given the
content that follows it, including the visible space printed for trailing
whitespace.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Sep 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e8364a1

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

This PR includes changesets to release 1 package
Name Type
prettier-plugin-marko 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

@codecov

codecov Bot commented Sep 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.20%. Comparing base (89fe9f6) to head (e8364a1).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #151      +/-   ##
==========================================
+ Coverage   97.16%   97.20%   +0.03%     
==========================================
  Files           8        8              
  Lines         318      322       +4     
  Branches       56       57       +1     
==========================================
+ Hits          309      313       +4     
  Misses          3        3              
  Partials        6        6              

☔ 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.

@coderabbitai

coderabbitai Bot commented Sep 23, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: d04149ce-8b55-4d1c-a260-5490a89d7bb8

📥 Commits

Reviewing files that changed from the base of the PR and between 89fe9f6 and e8364a1.

⛔ Files ignored due to path filters (4)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and included by **
  • src/__tests__/fixtures/text-backslashes/__snapshots__/auto.expected.marko is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/text-backslashes/__snapshots__/concise.expected.marko is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/text-backslashes/__snapshots__/html.expected.marko is excluded by !**/__snapshots__/** and included by **
📒 Files selected for processing (7)
  • .changeset/text-backslashes.md
  • agent-feedback/items/2026-08-21-text-backslash-doubling.md
  • package.json
  • src/__tests__/fixtures/text-backslashes/template.marko
  • src/__tests__/index.test.ts
  • src/index.ts
  • src/utils/visible-space.ts
💤 Files with no reviewable changes (1)
  • agent-feedback/items/2026-08-21-text-backslash-doubling.md

Included review availability: 0 reviews are currently available. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


Walkthrough

Text printing now uses escapeText with the following text or placeholder content. Visible-space handling escapes trailing backslashes before inserting placeholders. The tests add backslash cases and run the no-JavaScript-parser checks as normal tests. The htmljs-parser dependency range is updated to ^5.16.0.

Merge Risk: ⚪ Minimal · up to e8364

The backslash-formatting change has no identified issue that needs correction before merge; normal checks still apply.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. (3 skipped: 3… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: escaping only text backslashes that border a placeholder.
Description check ✅ Passed The description explains the backslash-doubling problem, the htmljs-parser 5.16 fix, and the related test coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 11.11% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 9 functions across 3 files. (3 skipped: 3 unsupported.)

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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

@DylanPiercey
DylanPiercey merged commit 221d8ac into main Sep 23, 2026
11 checks passed
@github-actions github-actions Bot mentioned this pull request Sep 23, 2026
@DylanPiercey
DylanPiercey deleted the dpiercey-ws-prettier-marko-async-ulp3vg-text-backslashes branch September 23, 2026 18:01
@DylanPiercey DylanPiercey moved this to Done in Roadmap Oct 2, 2026
@DylanPiercey DylanPiercey self-assigned this Oct 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant