File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ export function init({ groups }) {
5454 tk . COMMA ,
5555 tk . DOT ,
5656 tk . EXCLAMATION ,
57+ tk . PERCENT ,
5758 tk . QUERY ,
5859 tk . QUOTE ,
5960 tk . SEMI ,
@@ -211,6 +212,7 @@ export function init({ groups }) {
211212 // Force URL with scheme prefix followed by anything sane
212213 ta ( SchemeColon , groups . domain , Url ) ;
213214 tt ( SchemeColon , tk . SLASH , Url ) ;
215+ tt ( SchemeColon , tk . QUERY , Url ) ;
214216 ta ( UriPrefix , groups . domain , Url ) ;
215217 ta ( UriPrefix , qsAccepting , Url ) ;
216218 tt ( UriPrefix , tk . SLASH , Url ) ;
Original file line number Diff line number Diff line change @@ -37,8 +37,9 @@ describe('linkifyjs', () => {
3737
3838 describe ( 'registerCustomProtocol' , ( ) => {
3939 beforeEach ( ( ) => {
40- linkify . registerCustomProtocol ( 'instagram' , true ) ;
4140 linkify . registerCustomProtocol ( 'view-source' ) ;
41+ linkify . registerCustomProtocol ( 'instagram' , true ) ;
42+ linkify . registerCustomProtocol ( 'magnet' , true ) ;
4243 } ) ;
4344
4445 it ( 'Detects basic protocol' , ( ) => {
@@ -49,6 +50,12 @@ describe('linkifyjs', () => {
4950 expect ( linkify . test ( 'instagram://user/nfrasser' , 'url' ) ) . to . be . ok ;
5051 } ) ;
5152
53+ it ( 'Detects magnet protocol' , ( ) => {
54+ const magnetLink =
55+ 'magnet:?xt=urn:btih:5a7f5e0f3ce439e2f1a83e718a8405ec8809110b&dn=ernfkjenrkfk%5FSQ80%5FV%5Fv1.0.0%5Ferfnkerkf%5Ferfnkerkfefrfvegrteggt.net.rar' ;
56+ expect ( linkify . test ( magnetLink , 'url' ) ) . to . be . ok ;
57+ } ) ;
58+
5259 it ( 'Detects compound protocol' , ( ) => {
5360 expect ( linkify . test ( 'view-source://http://github.com/' , 'url' ) ) . to . be . ok ;
5461 } ) ;
You can’t perform that action at this time.
0 commit comments