Skip to content

Open a Code Span After an Even Backslash Run in pr_review.py #3265

Closed

Description

@ptr727

The shape

CodeSpans in scripts/pr_review.py refuses a backtick run that a backslash precedes, (?<![\\])`, since an escaped tick opens nothing. Two backslashes escape each other, though, so the run after an even number of them is live. GitHub opens a span there, and the reader does not.

Constructed case:

x \\`y` z

GitHub renders a literal backslash and y as a code span. The reader finds no span, so a tag inside such a span reads as live.

The inline HTML readers beside it take the even run already, consuming it as part of the match. That does not carry over to the span, since a span's match is what sub replaces and what finditer's callers slice by offset.

Expected

A backtick run after an even number of backslashes opens a span, with the constructed case pinned by a test. No reviewer body has been seen carrying the shape, so this ranks low.

Found while answering a review of the #3235 fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementscript

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions