mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
fix(simpleautolink): fix mail simpleAutoLink to ignore urls with @ symbol
Urls with @ symbol will not be incorrectly converted to mail addressed Closes #204
This commit is contained in:
parent
c4e82d855e
commit
8ebb25e486
BIN
dist/showdown.js
vendored
BIN
dist/showdown.js
vendored
Binary file not shown.
BIN
dist/showdown.js.map
vendored
BIN
dist/showdown.js.map
vendored
Binary file not shown.
BIN
dist/showdown.min.js
vendored
BIN
dist/showdown.min.js
vendored
Binary file not shown.
BIN
dist/showdown.min.js.map
vendored
BIN
dist/showdown.min.js.map
vendored
Binary file not shown.
|
@ -5,7 +5,7 @@ showdown.subParser('autoLinks', function (text, options) {
|
|||
|
||||
var simpleURLRegex = /\b(((https?|ftp|dict):\/\/|www\.)[^'">\s]+\.[^'">\s]+)(?=\s|$)(?!["<>])/gi,
|
||||
delimUrlRegex = /<(((https?|ftp|dict):\/\/|www\.)[^'">\s]+)>/gi,
|
||||
simpleMailRegex = /\b(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)\b/gi,
|
||||
simpleMailRegex = /(?:^|[ \n\t])([A-Za-z0-9!#$%&'*+-/=?^_`\{|}~\.]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)(?:$|[ \n\t])/gi,
|
||||
delimMailRegex = /<(?:mailto:)?([-.\w]+@[-a-z0-9]+(\.[-a-z0-9]+)*\.[a-z]+)>/gi;
|
||||
|
||||
text = text.replace(delimUrlRegex, '<a href=\"$1\">$1</a>');
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<p><a href="http://website.com/img@x2.jpg">http://website.com/img@x2.jpg</a></p>
|
||||
|
||||
<p><a href="http://website.com/img-x2.jpg">http://website.com/img-x2.jpg</a></p>
|
||||
|
||||
<p><a href="http://website.com/img@x2">http://website.com/img@x2</a></p>
|
||||
|
||||
<p><a href="http://website.com/img@.jpg">http://website.com/img@.jpg</a></p>
|
|
@ -0,0 +1,7 @@
|
|||
http://website.com/img@x2.jpg
|
||||
|
||||
http://website.com/img-x2.jpg
|
||||
|
||||
http://website.com/img@x2
|
||||
|
||||
http://website.com/img@.jpg
|
|
@ -15,7 +15,7 @@ describe('makeHtml() features testsuite', function () {
|
|||
converter = new showdown.Converter({parseImgDimensions: true});
|
||||
} else if (testsuite[i].name === '#69.header_level_start') {
|
||||
converter = new showdown.Converter({headerLevelStart: 3});
|
||||
} else if (testsuite[i].name === '#164.1.simple_autolink') {
|
||||
} else if (testsuite[i].name === '#164.1.simple_autolink' || testsuite[i].name === '#204.certain-links-with-at-and-dot-break-url') {
|
||||
converter = new showdown.Converter({simplifiedAutoLink: true});
|
||||
} else if (testsuite[i].name === '#164.2.disallow_underscore_emphasis_mid_word') {
|
||||
converter = new showdown.Converter({literalMidWordUnderscores: true});
|
||||
|
|
Loading…
Reference in New Issue
Block a user