-
-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Autolinking as specified by the GFM spec #3381
Labels
issue/confirmed
Issue has been reviewed and confirmed to be present or accepted to be implemented
type/refactoring
Existing code has been cleaned up. There should be no new functionality.
Comments
lafriks
added
the
type/refactoring
Existing code has been cleaned up. There should be no new functionality.
label
Jan 16, 2018
3 tasks
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs during the next 2 weeks. Thank you for your contributions. |
lunny
added
issue/confirmed
Issue has been reviewed and confirmed to be present or accepted to be implemented
and removed
issue/stale
labels
Feb 9, 2019
mrsdizzie
added a commit
to mrsdizzie/gitea
that referenced
this issue
Mar 7, 2019
Rather than maintaining a complicated regex to match URLs for autolinking, gitea can use this existing go library that takes care of the matching with very little code change to gitea itself. After spending a while trying to find the perfect regex for all cases this library still works better as it is more flexible than a single regex ever will be. This will also fix the following issues: go-gitea#5844 go-gitea#3095 go-gitea#3381 This passes all our current tests and I've added new ones mentioned in those issues as well.
techknowlogick
pushed a commit
that referenced
this issue
Mar 7, 2019
* Replace linkRegex with xurls library Rather than maintaining a complicated regex to match URLs for autolinking, gitea can use this existing go library that takes care of the matching with very little code change to gitea itself. After spending a while trying to find the perfect regex for all cases this library still works better as it is more flexible than a single regex ever will be. This will also fix the following issues: #5844 #3095 #3381 This passes all our current tests and I've added new ones mentioned in those issues as well. * Use xurls.StrictMatchingScheme instead of xurls.Strict This is much faster and we only care about https? links to preserve existing behavior.
Closing per merged PR |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
issue/confirmed
Issue has been reviewed and confirmed to be present or accepted to be implemented
type/refactoring
Existing code has been cleaned up. There should be no new functionality.
After some more research about how GitHub handles autolinking, I wound up finding the proper GFM spec. One of the goals of #3354 is that of porting over functionality, which was previously provided by JavaScript, into Go, which is why I do not intend to include this as part of the PR, seeing as that is already quite big. However, once it is merged, it might be good to replace the
linkProcessor
inmodules/markup/html.go
with a proper processor following the GFM specification - which should hopefully solve once and for all all issues regarding autolinking not working.This would also fix #3095.
cc/ @ypnos
The text was updated successfully, but these errors were encountered: