Repository navigation
Conversation
Bare URLs such as https://host:9501/#/chat or https://example.com/#!/inbox were left as plain text: the permissive autolink fragment scan only accepted a fragment starting with a letter or digit and had no '/' or '!'. Allow the RFC 3986 fragment characters /!?=&@,; for scheme links.
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
|
Thanks! This landed on There's no separate upstream PR because md4c master already links these URLs (mity/md4c#454). That reaches enriched-markdown through software-mansion-labs/md4c#7, and we'll drop this patch when it lands. |
What/Why?
In T3 Code's mobile chat, a bare URL with a hash route isn't tappable.
https://studio.example.ts.net:9501/#/chatandhttps://example.com/#!/inboxrender as plain text, whilehttps://example.com/page#sectionlinks fine. Single-page apps (dev servers, dashboards behind Tailscale) commonly print URLs like this.Cause: in
md_analyze_permissive_autolink, the fragment segment for scheme links allows only.-+_:%~beside letters and digits, and the segment scan stops at the first character outside that set. For#/chatthat is the very first character, so the fragment is empty,endstays on the#, and the trailing-boundary check then rejects the whole autolink.Fix: for scheme links (
opener->ch == ':'), also allow/!?=&@,;in the fragment. All of these are valid fragment characters in RFC 3986.www.and e-mail autolinks are unchanged. Trailing sentence punctuation still stays outside the link, because the existing?!.,:*trim runs after the fragment scan.Testing
scripts/test-core-parser.shpasses. I added a line totests/fixtures/gfm.mdand re-recorded the golden dump. The only golden changes are that line: both URLs link in the four variants with permissive autolinks on, stay plain text inextensions-off-gfm, and the final.stays outside the link.See https://example.com/#/chat.,**https://example.com/#/chat**,https://example.com/docs#intro, next,http://localhost:3000/xandhttps://example.com:8080/chat. Each links with the expected bounds.Screenshots
iOS example app (
apps/ios-example, Text screen with a sample message), iPhone 17 Pro simulator, iOS 27.0. The same build with and without the one-line change.PR Checklist