diff --git a/index.js b/index.js index 8465da00..5b8b3618 100644 --- a/index.js +++ b/index.js @@ -53,7 +53,7 @@ module.exports = function(content) { content = [content]; links.forEach(function(link) { if(!loaderUtils.isUrlRequest(link.value, root)) return; - + if (link.value.indexOf('mailto:') > -1 ) return; var uri = url.parse(link.value); @@ -129,6 +129,9 @@ module.exports = function(content) { } if(config.interpolate && config.interpolate !== 'require') { + // Double escape quotes so that they are not unescaped completely in the template string + content = content.replace(/\\"/g, "\\\\\""); + content = content.replace(/\\'/g, "\\\\\'"); content = compile('`' + content + '`').code; } else { content = JSON.stringify(content); diff --git a/test/loaderTest.js b/test/loaderTest.js index b5957dc1..7efe7800 100644 --- a/test/loaderTest.js +++ b/test/loaderTest.js @@ -71,6 +71,11 @@ describe("loader", function() { 'module.exports = "
{title}