Skip to content

📦🔧:respect escaped code-span delimiters - #103

Merged
openinf-commit-queue[bot] merged 1 commit into
mainfrom
fix/escaped-code-delimiters
Oct 2, 2026
Merged

openinf-commit-queue[bot] merged 1 commit into
mainfrom
fix/escaped-code-delimiters

Conversation

@DerekNonGeneric

@DerekNonGeneric DerekNonGeneric commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

Escaped opening backticks were incorrectly converted into code spans.

This respects backslash parity for openers, handles an escaped first backtick
inside a longer run, preserves raw closing-run behavior inside a span, and adds
escape-parity and linear-time regressions.

Fixes #97.

Summary by CodeRabbit

  • Bug Fixes
    • Improved Markdown code-span conversion when opening backticks are preceded by backslashes: odd and even runs are handled correctly, and escape backslashes are preserved.
    • Backslashes before closing backticks remain part of the code text, and matching continues correctly after escaped openings.
    • Long inputs with escaped backticks continue to be processed efficiently.

Honor backslash parity when choosing an opening backtick run, including
an escaped first backtick in a longer run. Keep closing runs raw once a
span is open and preserve the scanner's linear behavior.

Add delimiter-parity, continuation, and performance regressions.

Signed-off-by: Derek Lewis <DerekNonGeneric@inf.is>
Assisted-by: Codex:gpt-6-astra
Fixes: #97
@coderabbitai

coderabbitai Bot commented Oct 2, 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: c99adedb-1a98-44f8-90ba-9f612471f693

📥 Commits

Reviewing files that changed from the base of the PR and between 8177c45 and 8d06a5c.

📒 Files selected for processing (3)
  • .changeset/escaped-code-delimiters.md
  • packages/util-text/src/helpers/md-code-spans-2-html.ts
  • packages/util-text/test/helpers/md-code-spans-2-html.ts

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 4 reviews per hour.


📝 Walkthrough

Walkthrough

The code-span helper now distinguishes escaped opening backtick runs by the parity of preceding backslashes. It updates matching and rendering behavior, with tests for escaped delimiters and a performance case.

Changes

Escaped code delimiters

Layer / File(s) Summary
Escaped delimiter matching and validation
packages/util-text/src/helpers/md-code-spans-2-html.ts, packages/util-text/test/helpers/md-code-spans-2-html.ts, .changeset/escaped-code-delimiters.md
The helper tracks backslash parity before opening backtick runs, adjusts matching for escaped runs, and preserves the preceding backslash in rendered text. Tests cover escaped delimiters and a 100,000-repetition performance case. A patch changeset records the update.

Priority: ⬇️ Low

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

Change: Bug fix

Merge Risk: ⚪ Minimal · up to 8d06a

This change makes escaped opening backticks no longer start code spans, and it includes regression and performance tests. No actionable merge-blocking risk remains.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1… Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly identifies the main change: handling escaped code-span delimiters. It is concise and related to the pull request objectives, although the emojis add minor noise.
Linked Issues check ✅ Passed The PR satisfies the coding requirements in [#97]. findBacktickRuns records backslash parity for each opening run. findMatchingRuns uses the remaining run length after an escaped first backtick an…
Out of Scope Changes check ✅ Passed The changes stay within [#97]. The source change implements escaped opening-delimiter handling and preserves closing-run behavior. The tests verify the required behavior and linear performance. The ch…
Full details: Docstring Coverage

Explanation

Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. (1 skipped: 1 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
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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

@DerekNonGeneric DerekNonGeneric added the 🚀 Status: Commit Queue Land this pull request when its checks pass label Oct 2, 2026
@openinf-commit-queue
openinf-commit-queue Bot merged commit 1a5e63d into main Oct 2, 2026
11 checks passed
@openinf-commit-queue openinf-commit-queue Bot removed the 🚀 Status: Commit Queue Land this pull request when its checks pass label Oct 2, 2026
@openinf-commit-queue
openinf-commit-queue Bot deleted the fix/escaped-code-delimiters branch October 2, 2026 03:57
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.

Code spans incorrectly consume escaped opening delimiters

1 participant