Skip to content

Commit 72cd7b3

Browse files
committed
fix autolink
1 parent a4bc12d commit 72cd7b3

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

Parser.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"license": "BSD-4-Clause",
99
"author": "SegmentFault",
10-
"version": "2.4.27",
10+
"version": "2.4.28",
1111
"scripts": {
1212
"test": "mocha",
1313
"build": "cake build"

src/Parser.coffee

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,7 @@ class Parser
335335

336336
# autolink url
337337
if enableAutoLink
338-
text = text.replace /(^|[^\"])(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\b([-a-zA-Z0-9()@:%_\+.~#?&\/=]*)|(?:mailto:)?[_a-z0-9-\.\+]+@[_\w-]+(?:\.[a-z]{2,})+)($|[^\"])/g, (matches...) =>
338+
text = text.replace /(^|[^\"])(https?:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{1,256}\b([-a-zA-Z0-9@:%_\+.~#?&\/=]*)|(?:mailto:)?[_a-z0-9-\.\+]+@[_\w-]+(?:\.[a-z]{2,})+)($|[^\"])/g, (matches...) =>
339339
url = @cleanUrl matches[2]
340340
link = @call 'parseLink', matches[2]
341341
"#{matches[1]}<a href=\"#{url}\">#{link}</a>#{matches[5]}"

0 commit comments

Comments
 (0)