From 8a959a6ddd29a8008a3082239dd88f57e482e95c Mon Sep 17 00:00:00 2001 From: Antonio Date: Mon, 28 Mar 2022 01:59:41 +0300 Subject: [PATCH] docs: added showdown configuration document --- docs/configuration.md | 60 +++++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 4 ++- 2 files changed, 63 insertions(+), 1 deletion(-) create mode 100644 docs/configuration.md diff --git a/docs/configuration.md b/docs/configuration.md new file mode 100644 index 0000000..760a97d --- /dev/null +++ b/docs/configuration.md @@ -0,0 +1,60 @@ +You can change Showdown's default behavior via options. + +## Set option + +### Globally + +Setting an option globally affects all Showdown instances. + +```js +showdown.setOption('optionKey', 'value'); +``` + +### Locally + +Setting an option locally affects the specified Converter object only. You can set local options via: + +=== "Constructor" + + ```js + var converter = new showdown.Converter({optionKey: 'value'}); + ``` + +=== "setOption() method" + + ```js + var converter = new showdown.Converter(); + converter.setOption('optionKey', 'value'); + ``` + +## Get option + +Showdown provides both local and global methods to retrieve previously set options: + +=== "getOption()" + + ```js + // Global + var myOption = showdown.getOption('optionKey'); + + //Local + var myOption = converter.getOption('optionKey'); + ``` + +=== "getOptions()" + + ```js + // Global + var showdownGlobalOptions = showdown.getOptions(); + + //Local + var thisConverterSpecificOptions = converter.getOptions(); + ``` + +### Get default options + +You can get Showdown's default options with: + +```js +var defaultOptions = showdown.getDefaultOptions(); +``` \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index 16401f6..9951def 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -32,4 +32,6 @@ nav: - Donations: donations.md - Quickstart: - Quickstart: quickstart.md - - Compatibility: compatibility.md \ No newline at end of file + - Compatibility: compatibility.md + - Configuration: + - Showdown options: configuration.md \ No newline at end of file