mirror of
https://github.com/markedjs/marked.git
synced 2026-11-30 16:48:05 +01:00
fix: reject GFM email autolink when the domain ends in _ or - (#4063)
This commit is contained in:
+1
-1
@@ -531,7 +531,7 @@ const inlineGfm: Record<InlineKeys, RegExp> = {
|
||||
delRDelim,
|
||||
url: edit(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/)
|
||||
.replace('protocol', _caseInsensitiveProtocol)
|
||||
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/)
|
||||
.replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/)
|
||||
.getRegex(),
|
||||
_backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,
|
||||
del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
<p>foo@bar.com_</p>
|
||||
<p>foo@bar.com-</p>
|
||||
@@ -0,0 +1,6 @@
|
||||
---
|
||||
gfm: true
|
||||
---
|
||||
foo@bar.com_
|
||||
|
||||
foo@bar.com-
|
||||
Reference in New Issue
Block a user