fix(remend): drop lookbehind from single-tilde pattern for Safari < 16.3 - #576
Open
s-andringa wants to merge 1 commit into
Open
fix(remend): drop lookbehind from single-tilde pattern for Safari < 16.3#576s-andringa wants to merge 1 commit into
s-andringa wants to merge 1 commit into
Conversation
Contributor
|
Someone is attempting to deploy a commit to the Vercel Team on Vercel. A member of the Team first needs to authorize it. |
s-andringa
marked this pull request as ready for review
August 12, 2026 19:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Refs #519.
What
Removes the lookbehind assertion from
remend's single-tilde escape pattern:The preceding word character is now captured and written back in the replacement, and the offset handed to
isInsideCodeBlockis shifted by its length so it still points at the~. Semantics are unchanged — Unicode support (\p{L},\p{N}, so CJK and other scripts) is fully preserved.Why
JSCore on iOS 16.0–16.2 / Safari < 16.3 does not support lookbehind and throws
SyntaxError: Invalid regular expression: invalid group specifier name. Because the pattern is a module-level constant, this throws during module evaluation — before any user code runs — so the whole chunk fails to export and the page goes blank. There is no way for a consumer to catch it. Safari only shipped lookbehind in 16.4 (caniuse).Scope
This PR deliberately only fixes
remend. #519 identifies a second lookbehind inmdast-util-gfm-autolink-literal@2, pulled in viaremark-gfm@4. That one is not addressed here, because the maintainer has stated the lookbehind is intentional and will not be changed: syntax-tree/mdast-util-gfm-autolink-literal#10 (comment). Projects needing full iOS 16.0–16.2 support will have to patch that dependency themselves (pnpm patch/patch-package).So this change does not single-handedly close #519 for every
streamdownconsumer. It does fix it outright for anyone depending onremenddirectly, without dragging inremark-gfm— which is my own use case, and the one bit of this that is squarely this repo's own code rather than a third party's.Testing
pnpm --filter remend test— 458/458 pass, no changes needed to existing tests (behaviour is identical)pnpm --filter streamdown test— 991/991 passpnpm check— cleandistoutput verified free of any(?<occurrencesChangeset included (
remend, patch).