always reset options. typo.

This commit is contained in:
Christopher Jeffrey 2012-02-19 22:28:55 -06:00
parent 3e42b67057
commit ad984d4f74
2 changed files with 7 additions and 5 deletions

View File

@ -77,7 +77,7 @@ var html = marked(markdown, options);
- __pedantic__: Conform to obscure parts of `markdown.pl` as much as possible. - __pedantic__: Conform to obscure parts of `markdown.pl` as much as possible.
Don't fix any of the original markdown bugs or poor behavior. Don't fix any of the original markdown bugs or poor behavior.
- __gfm__: Enabled github flavored markdown (default for backward compatibility). - __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. None of the above are mutually exclusive/inclusive.

View File

@ -704,7 +704,7 @@ noop.exec = noop;
*/ */
var marked = function(src, opt) { var marked = function(src, opt) {
if (opt) setOptions(opt); setOptions(opt);
return parse(block.lexer(src)); return parse(block.lexer(src));
}; };
@ -715,7 +715,9 @@ var marked = function(src, opt) {
var options; var options;
var setOptions = function(opt) { var setOptions = function(opt) {
options = opt || marked.defaults; if (!opt) opt = marked.defaults;
if (options === opt) return;
options = opt;
if (options.gfm) { if (options.gfm) {
block.fences = block.gfm.fences; block.fences = block.gfm.fences;
@ -756,12 +758,12 @@ options = marked.defaults;
*/ */
marked.parser = function(src, opt) { marked.parser = function(src, opt) {
if (opt) setOptions(opt); setOptions(opt);
return parse(src); return parse(src);
}; };
marked.lexer = function(src, opt) { marked.lexer = function(src, opt) {
if (opt) setOptions(opt); setOptions(opt);
return block.lexer(src); return block.lexer(src);
}; };