File tree Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Expand file tree Collapse file tree 4 files changed +29
-1
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,13 @@ module.exports = {
1212 linkify : false , // autoconvert URL-like texts to links
1313 linkTarget : '' , // set target to open link in
1414
15+ // linkifyPrefilter. Function that overwrite the default link prefilter,
16+ // specified by this regex: /www|@|\:\/\//
17+ //
18+ // @param { string } link that will be tested.
19+ // @returns { Boolean } whether or not the link passes the prefilter.
20+ linkifyPrefilter : null ,
21+
1522 // Enable some language-neutral replacements + quotes beautification
1623 typographer : false ,
1724
Original file line number Diff line number Diff line change @@ -12,6 +12,13 @@ module.exports = {
1212 linkify : false , // autoconvert URL-like texts to links
1313 linkTarget : '' , // set target to open link in
1414
15+ // linkifyPrefilter. Function that overwrite the default link prefilter,
16+ // specified by this regex: /www|@|\:\/\//
17+ //
18+ // @param { string } link that will be tested.
19+ // @returns { Boolean } whether or not the link passes the prefilter.
20+ linkifyPrefilter : null ,
21+
1522 // Enable some language-neutral replacements + quotes beautification
1623 typographer : false ,
1724
Original file line number Diff line number Diff line change @@ -12,6 +12,13 @@ module.exports = {
1212 linkify : false , // autoconvert URL-like texts to links
1313 linkTarget : '' , // set target to open link in
1414
15+ // linkifyPrefilter. Function that overwrite the default link prefilter,
16+ // specified by this regex: /www|@|\:\/\//
17+ //
18+ // @param { string } link that will be tested.
19+ // @returns { Boolean } whether or not the link passes the prefilter.
20+ linkifyPrefilter : null ,
21+
1522 // Enable some language-neutral replacements + quotes beautification
1623 typographer : false ,
1724
Original file line number Diff line number Diff line change @@ -95,7 +95,14 @@ module.exports = function linkify(state) {
9595 }
9696 if ( htmlLinkLevel > 0 ) { continue ; }
9797
98- if ( token . type === 'text' && LINK_SCAN_RE . test ( token . content ) ) {
98+ var linkifyPrefilter = state . options . linkifyPrefilter ;
99+ var passPrefilter = LINK_SCAN_RE . test ( token . content ) ;
100+ if ( linkifyPrefilter && typeof linkifyPrefilter === 'function' ) {
101+ // Use the custom prefilter for links.
102+ passPrefilter = linkifyPrefilter ( token . content ) ;
103+ }
104+
105+ if ( token . type === 'text' && passPrefilter ) {
99106
100107 // Init linkifier in lazy manner, only if required.
101108 if ( ! linkifier ) {
You can’t perform that action at this time.
0 commit comments