We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c990a62 commit 2402c21Copy full SHA for 2402c21
lib/index.js
@@ -132,7 +132,7 @@ function transformGfmAutolinkLiterals(tree) {
132
tree,
133
[
134
[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi, findUrl],
135
- [/([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/g, findEmail]
+ [/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu, findEmail]
136
],
137
{ignore: ['link', 'linkReference']}
138
)
@@ -274,6 +274,7 @@ function previous(match, email) {
274
(match.index === 0 ||
275
unicodeWhitespace(code) ||
276
unicodePunctuation(code)) &&
277
+ // If it’s an email, the previous character should not be a slash.
278
(!email || code !== 47)
279
280
}
0 commit comments