feat(Converter.options): add getOption(), setOption() and getOptions() to Converter object

Provides a way to get and set options directly in a Converter object
This commit is contained in:
Estevão Soares dos Santos 2015-05-27 01:37:01 +01:00
parent 141e3f5f44
commit db6f79b08d
5 changed files with 30 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

@ -280,7 +280,36 @@ showdown.Converter = function (converterOptions) {
return text;
}
/**
* Set an option of this Converter instance
* @param {string} key
* @param {string} value
*/
function setOption (key, value) {
options[key] = value;
}
/**
* Get the option of this Converter instance
* @param {string} key
* @returns {*}
*/
function getOption(key) {
return options[key];
}
/**
* Get the options of this Converter instance
* @returns {{}}
*/
function getOptions() {
return options;
}
return {
makeHtml: makeHtml
makeHtml: makeHtml,
setOption: setOption,
getOption: getOption,
getOptions: getOptions
};
};