-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Linkify breaks with URLs surrounded by color codes #63
Labels
Comments
Hmm, good catch! I will happily merge a PR fixing this! ❇️ |
any plan to fix this? |
This was referenced Sep 10, 2024
perlpunk
added a commit
to perlpunk/anser
that referenced
this issue
Sep 11, 2024
Fixes IonicaBizau#63 It handles the fact that escapeForHtml has already been called and matches `&` separately. I used the RFC (basically the last 5 rules) from: https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
perlpunk
added a commit
to perlpunk/anser
that referenced
this issue
Sep 11, 2024
Fixes IonicaBizau#63 It handles the fact that escapeForHtml has already been called and matches `&` separately. I used the RFC (basically the last 5 rules) from: https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
perlpunk
added a commit
to perlpunk/anser
that referenced
this issue
Sep 11, 2024
Fixes IonicaBizau#63 It handles the fact that escapeForHtml has already been called and matches `&` separately. I used the RFC (basically the last 5 rules) from: https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
perlpunk
added a commit
to perlpunk/anser
that referenced
this issue
Sep 11, 2024
Fixes IonicaBizau#63 It handles the fact that escapeForHtml has already been called and matches `&` separately. I used the RFC (basically the last 5 rules) from: https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
perlpunk
added a commit
to perlpunk/anser
that referenced
this issue
Sep 11, 2024
Fixes IonicaBizau#63 It handles the fact that escapeForHtml has already been called and matches `&` separately. I used the RFC (basically the last 5 rules) from: https://datatracker.ietf.org/doc/html/rfc3986#appendix-A
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have a URL that's got color codes around it and
linkify
the output, you'll get a</span>
in the link because the regex for URL (specifically the host/path portion) will match any non-whitespace character:anser/lib/index.js
Lines 196 to 198 in fb58237
Example
(Same code, just inlined here)
RunKit repro (same code as here): https://runkit.com/milas/605a270caf5fed001a4b6e93
Output
Solution
If we assume the input has been escaped with
escapeForHtml
, perhapslinkify
's regex could be made more strict to only match on URL safe characters? Just adding<
to the not matching set would also probably be sufficient for this case, but there might be other edge cases re: linkifying in general (i.e. not induced by having a surrounding color code) that are still missed.The text was updated successfully, but these errors were encountered: