diff --git a/examples/markdown/index.js b/examples/markdown/index.js index 53e40ac38e4..62d468fda21 100644 --- a/examples/markdown/index.js +++ b/examples/markdown/index.js @@ -17,7 +17,7 @@ var app = module.exports = express(); app.engine('md', function(path, options, fn){ fs.readFile(path, 'utf8', function(err, str){ if (err) return fn(err); - var html = marked.parse(str).replace(/\{([^}]+)\}/g, function(_, name){ + var html = marked.parse(str).replace(/\{([^{}]+)\}/g, function(_, name){ return escapeHtml(options[name] || ''); }); fn(null, html); diff --git a/examples/view-constructor/index.js b/examples/view-constructor/index.js index 3d673670e31..8ff76c12cda 100644 --- a/examples/view-constructor/index.js +++ b/examples/view-constructor/index.js @@ -14,7 +14,7 @@ var app = module.exports = express(); app.engine('md', function(str, options, fn){ try { var html = md(str); - html = html.replace(/\{([^}]+)\}/g, function(_, name){ + html = html.replace(/\{([^{}]+)\}/g, function(_, name){ return options[name] || ''; }); fn(null, html);