diff --git a/src/utils.js b/src/utils.js index 6622c2b..6251d26 100644 --- a/src/utils.js +++ b/src/utils.js @@ -80,15 +80,8 @@ export const ignoreElement = (html, ignore, mode = 'protect') => { const protectElement = (match, capture) => { return match.replace(capture, (match) => { return match - .replace(//g, '>') - .replace(/\//g, '/') - .replace(/"/g, '"') - .replace(/'/g, ''') - .replace(/\n/g, ' ') - .replace(/%/g, '%') - .replace(/\{/g, '{') - .replace(/\}/g, '}') + .replace(/\n/g, ' ') + .replace(/\r/g, ' ') .replace(/\s/g, ' ') }) } @@ -103,15 +96,8 @@ const protectElement = (match, capture) => { const unprotectElement = (match, capture) => { return match.replace(capture, (match) => { return match - .replace(/</g, '<') - .replace(/>/g, '>') - .replace(///g, '/') - .replace(/"/g, '"') - .replace(/'/g, "'") - .replace(/ /g, '\n') - .replace(/%/g, '%') - .replace(/{/g, '{') - .replace(/}/g, '}') + .replace(/ /g, '\n') + .replace(/ /g, '\r') .replace(/ /g, ' ') }) }