Skip to content

Commit 75f9f0d

Browse files
committed
perf(external_link): faster regexp
1 parent d445b68 commit 75f9f0d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/plugins/filter/after_post_render/external_link.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
const { isExternalLink } = require('hexo-util');
44
let EXTERNAL_LINK_POST_ENABLED = true;
5-
const rATag = /<a(?:\s+?|\s+?[^<>]+\s+?)?href=["']((?:\/\/|http(?:s)?:)[^<>"']+)["'][^<>]*>/gi;
5+
const rATag = /<a(?:\s+?|\s+?[^<>]+\s+?)?href=["']((?:http(?:s)?:|\/\/)[^<>"']+)["'][^<>]*>/gi;
66
const rTargetAttr = /target=/i;
77
const rRelAttr = /rel=/i;
88
const rRelStrAttr = /rel=["']([^<>"']*)["']/i;

lib/plugins/filter/after_render/external_link.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const { isExternalLink } = require('hexo-util');
44

55
let EXTERNAL_LINK_SITE_ENABLED = true;
6-
const rATag = /<a(?:\s+?|\s+?[^<>]+\s+?)?href=["']((?:\/\/|http(?:s)?:)[^<>"']+)["'][^<>]*>/gi;
6+
const rATag = /<a(?:\s+?|\s+?[^<>]+\s+?)?href=["']((?:http(?:s)?:|\/\/)[^<>"']+)["'][^<>]*>/gi;
77
const rTargetAttr = /target=/i;
88
const rRelAttr = /rel=/i;
99
const rRelStrAttr = /rel=["']([^<>"']*)["']/i;

0 commit comments

Comments
 (0)