fix: limit tagName to whole world

This commit is contained in:
Zhicheng Wang 2017-07-30 16:23:26 +08:00
parent 2c9e783817
commit f7b656443d
1 changed files with 1 additions and 1 deletions

View File

@ -1,5 +1,5 @@
function mark(text) {
return text.replace(/<(h\d|header|p|a)([\s\S]*?)>([\s\S]+?)<\/\1>/gi, function ($0, $1, $2, $3) {
return text.replace(/<(h\d|header|p|a)(\b[\s\S]*?)>([\s\S]+?)<\/\1>/gi, function ($0, $1, $2, $3) {
const suffix = isTranslation($3) ? 'result' : 'origin=off';
return `<${$1} translation-${suffix} ${$2}>${$3}</${$1}>`;
});