always reset options. typo.
This commit is contained in:
parent
3e42b67057
commit
ad984d4f74
@ -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.
|
||||||
|
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user