Skip to content

Commit

Permalink
feat(Converter.options): add getOption(), setOption() and getOptions(…
Browse files Browse the repository at this point in the history
…) to Converter object

Provides a way to get and set options directly in a Converter object
  • Loading branch information
tivie committed May 27, 2015
1 parent 141e3f5 commit db6f79b
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 10 deletions.
45 changes: 40 additions & 5 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.

31 changes: 30 additions & 1 deletion src/showdown.js
Expand Up @@ -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
};
};

0 comments on commit db6f79b

Please sign in to comment.