-
Notifications
You must be signed in to change notification settings - Fork 3.5k
fix: Make www case-sensitive when detecting link starts
#3770
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @vaskkey, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request resolves an inconsistency in autolink detection for Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses the case-sensitivity of www. autolinks to align with GFM behavior. The change in src/rules.ts is logical, and the new tests in autolinks.md and autolinks.html properly cover the intended fix. However, I've identified a significant related issue: the text parsing rule was not updated along with the url rule. This oversight can lead to incorrect parsing for URLs that use uppercase protocols when they are preceded by other text. I've left a detailed comment on this issue.
|
@vaskkey is attempting to deploy a commit to the MarkedJS Team on Vercel. A member of the Team first needs to authorize it. |
|
/gemini review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request correctly addresses the case-sensitivity of www. autolinks by removing the case-insensitive flag from the URL regex and explicitly handling case-insensitivity for protocols like http and ftp. The addition of test cases is great for ensuring the fix is working as expected and preventing regressions. I have one minor suggestion in src/rules.ts to improve code maintainability by removing a small inconsistency and duplication.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks 💯
# [16.4.0](v16.3.0...v16.4.0) (2025-10-07) ### Bug Fixes * Fix backtick and code rendering in links ([#3783](#3783)) ([302ee59](302ee59)) * fix links with square brackets in inline code break wrapping italics ([#3785](#3785)) ([e3c0d3e](e3c0d3e)) * Make `www` case-sensitive when detecting link starts ([#3770](#3770)) ([626d961](626d961)) ### Features * Add async provideParser provideLexer ([#3756](#3756)) ([09577e5](09577e5))
Marked version: 16.3.0
Markdown flavor: GitHub Flavored Markdown
Description
www.prefixhttpandftpprefixes in textExpectation
Only lowercase
www.should be detected as the start of an autolink. Variants likeWww.example.comorWWW.example.comshould be treated as plain text, not converted to links.Case insensitive
httporftplikeHtTp"//that is in text e.g.test HTTP://example.comshould be autolinkedResult
Previously, the URL regex pattern used the
iflag (case-insensitive), causingwww.,Www.,WWW., and other case variations to be detected as autolink starts. This was inconsistent with how GitHub handles autolinks.What was attempted
Modified the
inlineGfm.urlregex insrc/rules.tsto:'i')[fF][tT][pP]|[hH][tT][tT][pP][sS]?www.case-sensitive (lowercase only)Added test cases to verify:
www.example.com- converted to linkWww.example.com- plain textWWW.example.com- plain textContributor
test/specs/new/autolinks.mdandtest/specs/new/autolinks.html)Committer
In most cases, this should be a different person than the contributor.