From 383f9d4f0e14dab843e03decb3bd0b4bc5bce407 Mon Sep 17 00:00:00 2001 From: Eugene Sharygin Date: Sun, 4 Jun 2017 14:00:13 +0300 Subject: [PATCH] Use split-join for plain string replacement This commit replaces the usage of `String.prototype.replace` since it requires escaping against interpreted patterns such as `$&` or `$$`. --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 416197e..b6731b1 100644 --- a/index.js +++ b/index.js @@ -12,7 +12,7 @@ module.exports = function(markdown, callback) { if (err) return callback(err) var body = marked(markdown) - var html = template.replace('{{markdown}}', body) + var html = template.split('{{markdown}}').join(body) var inlinedHtml = inlineStyles(html, __dirname) callback(null, inlinedHtml.toString())