Skip to content

Commit

Permalink
fix(showdown): fix for options merging into globalOptions
Browse files Browse the repository at this point in the history
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
  • Loading branch information
tivie committed May 26, 2015
1 parent a4e67a0 commit ddd6011
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 7 deletions.
10 changes: 8 additions & 2 deletions dist/showdown.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/showdown.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/showdown.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/showdown.min.js.map

Large diffs are not rendered by default.

8 changes: 7 additions & 1 deletion src/showdown.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ showdown.Converter = function (converterOptions) {

converterOptions = converterOptions || {};

var options = globalOptions,
var options = {},
langExtensions = [],
outputModifiers = [],
parserOrder = [
Expand All @@ -142,6 +142,12 @@ showdown.Converter = function (converterOptions) {
'unescapeSpecialChars'
];

for (var gOpt in globalOptions) {
if (globalOptions.hasOwnProperty(gOpt)) {
options[gOpt] = globalOptions[gOpt];
}
}

// Merge options
if (typeof converterOptions === 'object') {
for (var opt in converterOptions) {
Expand Down

0 comments on commit ddd6011

Please sign in to comment.