diff --git a/index.js b/index.js index 793f269..ebe9207 100644 --- a/index.js +++ b/index.js @@ -59,7 +59,16 @@ Renderer.prototype.image = function(href, title, text) { return this.showImageText ? text : ''; } Renderer.prototype.text = function(text) { - return text; + return text.replace(/&(?:amp|lt|gt|quot|#39);/g, function (match) { + switch (match) { + case '&': return '&'; + case '<': return '<'; + case '>': return '>'; + case '"': return '"'; + case ''': return "'"; + } + return match; + }); } module.exports = Renderer;