GeezerVison is showing github.com — fix(client): a long run of fence markers is read in one pass by juliusmarminge · Pull Request #41983 · pingdotgg/t3code
Conversation
Deciding that a line starting with fence markers is not a code fence re-read the rest of the line once per marker character. This makes that decision a single pass.
The fence pattern now takes the whole marker run as the marker, so a line that turns out not to be a fence is given up on after one pass. Which lines count as fences, and what is read as the marker and the info string, is unchanged.
Testing
- Added a row to the existing "splits … in one pass" table in
pullRequestMarkdown.test.ts: 100,000 backticks followed by a line separator. Without the change the row runs past the test timeout (about 45 s on my machine); with it the whole file passes in well under a second of test time. The existing fence tests are untouched and pass.
- Compared the old and new pattern on every line of up to 7 characters over backtick, tilde, space, tab, a letter, carriage return and U+2028 (960,800 lines): same match and same groups on all of them.
- Timed the new pattern alone in Node on 100k, 400k, 1.6M and 6.4M backticks: 0.5, 1.9, 7.2 and 29 ms.
vp run check:changed passes.
🤖 Generated with Claude Code
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
A line that starts with a fence marker but is not a fence, because a
line separator or a lone carriage return follows on the same line, was
re-read once per marker character. The marker now always covers the
whole run, so such a line is given up on after one pass. Which lines
count as fences is unchanged.
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Labels
size:XS
0-9 changed lines (additions + deletions).
vouch:trusted
Author is trusted by repo permissions or the VOUCHED list.
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.