diff --git a/src/rules.ts b/src/rules.ts index 67dcb09ece..e661bee4a3 100644 --- a/src/rules.ts +++ b/src/rules.ts @@ -408,12 +408,15 @@ const inlineGfm: Record = { ...inlineNormal, emStrongRDelimAst: emStrongRDelimAstGfm, emStrongLDelim: emStrongLDelimGfm, - url: edit(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/, 'i') + url: edit(/^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/) + .replace('protocol', /[fF][tT][pP]|[hH][tT][tT][pP][sS]?/) .replace('email', /[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/) .getRegex(), _backpedal: /(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/, del: /^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/, - text: /^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\me@example.com

-

test@test.com

\ No newline at end of file +

test@test.com

+ +

www.example.com

+ +

Www.example.com

+ +

WWW.example.com

+ +

(See hTtPS://example.com/fhqwhgads.)

diff --git a/test/specs/new/autolinks.md b/test/specs/new/autolinks.md index 1f5f739c49..e5e41fd761 100644 --- a/test/specs/new/autolinks.md +++ b/test/specs/new/autolinks.md @@ -12,4 +12,12 @@ hTtP://fOo.CoM **me@example.com** -__test@test.com__ \ No newline at end of file +__test@test.com__ + +www.example.com + +Www.example.com + +WWW.example.com + +(See hTtPS://example.com/fhqwhgads.)