Repository navigation
fix(client-runtime): a line of inline triple-backtick code no longer breaks media in PR descriptions - #30571
fix(client-runtime): a line of inline triple-backtick code no longer breaks media in PR descriptions#30571MarcoDotIO wants to merge 1 commit into
Conversation
…flips later code blocks in pull request bodies A backtick fence's info string cannot hold a backtick, so a line such as "```npm test``` passes." is inline code. The pull request body splitter read it as a fence opener, which inverted every fence after it: media links outside code stayed as plain links, and a media link inside a later code block was lifted out, splitting the block. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — This fixes inline triple-backtick code disrupting subsequent media rendering in PR descriptions on web and mobile. The change is limited to parsing and retains existing media handling and URL validation. You can add or adjust custom eligibility rules. Learn more. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Problem
A pull request body with a line such as
```npm test``` passes.gets the wrong media embeds. In CommonMark that line is inline code, because a backtick fence's info string cannot contain a backtick, and the Markdown renderer (remark) treats it that way.splitPullRequestBodyinpackages/client-runtime/src/pullRequestMarkdown.tsreads it as a fence opener instead. That flips every fence after it inside out:Where it shows up: the web
PullRequestMarkdown(apps/web/src/components/pullRequest/PullRequestMarkdown.tsx) and the mobilePullRequestMarkdownandPullRequestDescriptionall render the segments fromsplitPullRequestBody(body).Repro body:
Expected: prose, a video, then a code block holding the PNG URL. Actual on
main: one Markdown segment that ends in an unclosed fence, then the PNG lifted out as an image, then a lone```.Live repro
The next two lines are a live repro. On
main, T3 Code's PR view shows the image URL below as plain text, and the fences in the rest of this description come out inside out.vp testpasses.https://gist.githubusercontent.com/MarcoDotIO/13fbc29322df98233b54dc4b2e60187b/raw/demo-image.png
Change
When no fence is open, a backtick fence line whose info string contains a backtick is not treated as an opener. It drops through to the normal line handling as prose. Tilde fences are unchanged, since their info strings may contain backticks, and so are lines inside an open fence.
Scope and approval
A small, focused fix for an obvious bug, so no issue is needed. It's one condition in one function, following the CommonMark rule the renderer already uses, plus a regression test. It does not touch the CRLF fence fix in #30352, and the two merge cleanly.
Before and after
This PR open in the web dev client's pull request view, scrolled to the live repro above.
upstream/main)Verification
Added
does not open a fence on a line of inline triple-backtick codetopackages/client-runtime/src/pullRequestMarkdown.test.ts.Before the fix (on
main):After the fix:
Also ran:
apps/mobile/src/features/pull-requests/pullRequestDescriptionContent.test.ts: passes.vp lintandvp fmt --checkonpackages/client-runtime/src, andtsc --noEmitinpackages/client-runtime: all clean.remark-parsefrom the web app's dependencies. It gives inline code, then a paragraph, then a code block whose value is the PNG URL, which is what the splitter now matches.Proof: a regression test that fails on
main, plus before/after captures of this PR in the web client. Reviewed with GPT-6.1 Sol through the Codex CLI.Created with Claude Opus 5.5 in the Claude Code desktop app.
🤖 Generated with Claude Code