fix(showdown): fix for options merging into globalOptions

Passing an option to a specific converter affects other instances of the converter since options are merged into showdown's global options.
This commit fixes that.

Closes #153
This commit is contained in:
Estevão Soares dos Santos 2015-05-26 19:46:07 +01:00
parent a4e67a0ee7
commit ddd6011df2
5 changed files with 7 additions and 1 deletions

BIN
dist/showdown.js vendored

Binary file not shown.

BIN
dist/showdown.js.map vendored

Binary file not shown.

BIN
dist/showdown.min.js vendored

Binary file not shown.

Binary file not shown.

View File

@ -131,7 +131,7 @@ showdown.Converter = function (converterOptions) {
converterOptions = converterOptions || {}; converterOptions = converterOptions || {};
var options = globalOptions, var options = {},
langExtensions = [], langExtensions = [],
outputModifiers = [], outputModifiers = [],
parserOrder = [ parserOrder = [
@ -142,6 +142,12 @@ showdown.Converter = function (converterOptions) {
'unescapeSpecialChars' 'unescapeSpecialChars'
]; ];
for (var gOpt in globalOptions) {
if (globalOptions.hasOwnProperty(gOpt)) {
options[gOpt] = globalOptions[gOpt];
}
}
// Merge options // Merge options
if (typeof converterOptions === 'object') { if (typeof converterOptions === 'object') {
for (var opt in converterOptions) { for (var opt in converterOptions) {