Skip to content

Commit

Permalink
fix(excludeTrailingPunctuationFromURL): add comma to punctuation list
Browse files Browse the repository at this point in the history
Closes #354
  • Loading branch information
tivie committed Mar 9, 2017
1 parent 759a334 commit fa35fd5
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dist/showdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/showdown.js.map

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions dist/showdown.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/subParsers/autoLinks.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// url allowed chars [a-z\d_.~:/?#[]@!$&'()*+,;=-]

var simpleURLRegex = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)()(?=\s|$)(?!["<>])/gi,
simpleURLRegex2 = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?()]?)(?=\s|$)(?!["<>])/gi,
simpleURLRegex2 = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+?)([.!?,()"\[\]]?)(?=\s|$)(?!["<>])/gi,
//simpleURLRegex3 = /\b(((https?|ftp):\/\/|www\.)[a-z\d.-]+\.[a-z\d_.~:/?#\[\]@!$&'()*+,;=-]+?)([.!?()]?)(?=\s|$)(?!["<>])/gi,
delimUrlRegex = /<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)>/gi,
simpleMailRegex = /(^|\s)(?:mailto:)?([A-Za-z0-9!#$%&'*+-/=?^_`{|}~.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?=$|\s)/gmi,
Expand Down
2 changes: 2 additions & 0 deletions test/features/excludeTrailingPunctuationFromURLs-option.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@
<p>url <a href="http://www.google.com">http://www.google.com</a>!</p>
<p>url <a href="http://www.google.com">http://www.google.com</a>? foo</p>
<p>url (<a href="http://www.google.com">http://www.google.com</a>) bazinga</p>
<p>url [<a href="http://www.google.com">http://www.google.com</a>] bazinga</p>
<p>url <a href="http://www.google.com">http://www.google.com</a>, bar</p>
4 changes: 4 additions & 0 deletions test/features/excludeTrailingPunctuationFromURLs-option.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,7 @@ url http://www.google.com!
url http://www.google.com? foo

url (http://www.google.com) bazinga

url [http://www.google.com] bazinga

url http://www.google.com, bar

0 comments on commit fa35fd5

Please sign in to comment.