Skip to content

fix: pass existing backslash escapes through escape_content - #27

Open
imphil wants to merge 1 commit into
sou1118:mainfrom
imphil:pass-through-backslash
Open

imphil wants to merge 1 commit into
sou1118:mainfrom
imphil:pass-through-backslash

Conversation

@imphil

@imphil imphil commented Sep 12, 2026

Copy link
Copy Markdown

escape_content had no case for backslash, so it escaped the backslash of an escape sequence that was already in the source: \] became \\], a literal backslash followed by a bare ] that closes the caller's content block early. Copy escape sequences through whole instead.

Summary by CodeRabbit

  • Bug Fixes
    • Existing backslash escapes are now preserved during diff rendering instead of being escaped a second time.
    • Escaped characters such as \* and \[ now display correctly.

escape_content had no case for backslash, so it escaped the backslash of an
escape sequence that was already in the source: `\]` became `\\]`, a literal
backslash followed by a bare `]` that closes the caller's content block early.
Copy escape sequences through whole instead.
@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: af8b07df-653d-472d-931b-56d5c91db84f

📥 Commits

Reviewing files that changed from the base of the PR and between 8f7dedf and 949079b.

📒 Files selected for processing (2)
  • src/render.rs
  • tests/integration.rs

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The renderer now preserves existing backslash escape sequences during diff content escaping. Unit and integration tests verify that escaped brackets and asterisks are not double-escaped.

Changes

Escape Preservation

Layer / File(s) Summary
Content escaping and regression coverage
src/render.rs, tests/integration.rs
escape_content preserves existing backslash escape sequences. Unit and integration tests verify escaped brackets and asterisks remain unchanged.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: sou1118

Merge Risk: ⚪ Minimal · up to 94907

The renderer now preserves existing escapes without introducing a current merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: preserving existing backslash escapes in escape_content.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 2 files.
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.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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