Skip to content

Commit

Permalink
Fix parenthesis after commas
Browse files Browse the repository at this point in the history
close #94
  • Loading branch information
rlidwka committed Apr 19, 2022
1 parent 945df9f commit eb7463d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/re.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ module.exports = function (opts) {
'\\{(?:(?!' + re.src_ZCc + '|[}]).)*\\}|' +
'\\"(?:(?!' + re.src_ZCc + '|["]).)+\\"|' +
"\\'(?:(?!" + re.src_ZCc + "|[']).)+\\'|" +
"\\'(?=" + re.src_pseudo_letter + '|[-]).|' + // allow `I'm_king` if no pair found
"\\'(?=" + re.src_pseudo_letter + '|[-])|' + // allow `I'm_king` if no pair found
'\\.{2,}[a-zA-Z0-9%/&]|' + // google has many dots in "google search" links (#66, #81).
// github has ... in commit range links,
// Restrict to
Expand All @@ -64,16 +64,16 @@ module.exports = function (opts) {
// - parts of file path
// - params separator
// until more examples found.
'\\.(?!' + re.src_ZCc + '|[.]).|' +
'\\.(?!' + re.src_ZCc + '|[.]|$)|' +
(opts && opts['---'] ?
'\\-(?!--(?:[^-]|$))(?:-*)|' // `---` => long dash, terminate
:
'\\-+|'
) +
',(?!' + re.src_ZCc + ').|' + // allow `,,,` in paths
';(?!' + re.src_ZCc + ').|' + // allow `;` if not followed by space-like char
'\\!+(?!' + re.src_ZCc + '|[!]).|' + // allow `!!!` in paths, but not at the end
'\\?(?!' + re.src_ZCc + '|[?]).' +
',(?!' + re.src_ZCc + '|$)|' + // allow `,,,` in paths
';(?!' + re.src_ZCc + '|$)|' + // allow `;` if not followed by space-like char
'\\!+(?!' + re.src_ZCc + '|[!]|$)|' + // allow `!!!` in paths, but not at the end
'\\?(?!' + re.src_ZCc + '|[?]|$)' +
')+' +
'|\\/' +
')?';
Expand Down
2 changes: 2 additions & 0 deletions test/fixtures/links.txt
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ http://example.com/foo_bar/
http://example.com/foo_bar,
http://example.com/foo_bar

http://index-of.es/Android/Professional.Android.2.Application.Development.(Wrox,.2010,.0470565527).pdf

https://github.com/markdown-it/linkify-it/compare/360b13a733f521a8d4903d3a5e1e46c357e9d3ce...f580766349525150a80a32987bb47c2d592efc33

https://www.google.com/search?sxsrf=ACYBGNTJFmX-GjNJ8fM-2LCkqyNyxGU1Ng%3A1575534146332&ei=Qr7oXf7rE4rRrgSEgrmoAw&q=clover&oq=clover&gs_l=psy-ab.3..0i67j0l9.2986.3947..4187...0.2..0.281.1366.1j0j5......0....1..gws-wiz.......0i71j35i39j0i131.qWp1nz4IJVA&ved=0ahUKEwj-lP6Iip7mAhWKqIsKHQRBDjUQ4dUDCAs&uact=5
Expand Down

0 comments on commit eb7463d

Please sign in to comment.