From ad984d4f74bb1cdf52ea31adb67eac0e9ab21a30 Mon Sep 17 00:00:00 2001 From: Christopher Jeffrey Date: Sun, 19 Feb 2012 22:28:55 -0600 Subject: [PATCH] always reset options. typo. --- README.md | 2 +- lib/marked.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 0d668a07..c7e47b8c 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ var html = marked(markdown, options); - __pedantic__: Conform to obscure parts of `markdown.pl` as much as possible. Don't fix any of the original markdown bugs or poor behavior. - __gfm__: Enabled github flavored markdown (default for backward compatibility). -- __sanitize__: Sanitize the output. Ignore an HTML that has been input. +- __sanitize__: Sanitize the output. Ignore any HTML that has been input. None of the above are mutually exclusive/inclusive. diff --git a/lib/marked.js b/lib/marked.js index 2279f4a4..9bf431c0 100644 --- a/lib/marked.js +++ b/lib/marked.js @@ -704,7 +704,7 @@ noop.exec = noop; */ var marked = function(src, opt) { - if (opt) setOptions(opt); + setOptions(opt); return parse(block.lexer(src)); }; @@ -715,7 +715,9 @@ var marked = function(src, opt) { var options; var setOptions = function(opt) { - options = opt || marked.defaults; + if (!opt) opt = marked.defaults; + if (options === opt) return; + options = opt; if (options.gfm) { block.fences = block.gfm.fences; @@ -756,12 +758,12 @@ options = marked.defaults; */ marked.parser = function(src, opt) { - if (opt) setOptions(opt); + setOptions(opt); return parse(src); }; marked.lexer = function(src, opt) { - if (opt) setOptions(opt); + setOptions(opt); return block.lexer(src); };