a bug about options

Ensure it can traverse the extensions list
This commit is contained in:
八克白 2013-07-13 23:24:56 +08:00
parent c579d08c9a
commit aa78a8996d

View File

@ -219,11 +219,13 @@ if (converter_options && converter_options.extensions) {
var self = this; var self = this;
// if a string is given like this new Showdown.converter({ extensions: 'github' }) var extensionList = converter_options.extensions;
// Ensure it can traverse the extensions list
if(typeof converter_options.extensions === 'string'){ // if a string is given like this new Showdown.converter({ extensions: 'github' })
converter_options.extensions = [converter_options.extensions]; // Ensure it can traverse the extensions list
} if(typeof extensionList === 'string'){
converter_options.extensions = [extensionList];
}
// Iterate over each plugin // Iterate over each plugin
Showdown.forEach(converter_options.extensions, function(plugin){ Showdown.forEach(converter_options.extensions, function(plugin){