|
@@ -1,4 +1,4 @@
|
|
-;/*! showdown 06-01-2017 */
|
|
|
|
|
|
+;/*! showdown 08-01-2017 */
|
|
(function(){
|
|
(function(){
|
|
/**
|
|
/**
|
|
* Created by Tivie on 13-07-2015.
|
|
* Created by Tivie on 13-07-2015.
|
|
@@ -142,6 +142,7 @@ var showdown = {},
|
|
parsers = {},
|
|
parsers = {},
|
|
extensions = {},
|
|
extensions = {},
|
|
globalOptions = getDefaultOpts(true),
|
|
globalOptions = getDefaultOpts(true),
|
|
|
|
+ setFlavor = 'vanilla',
|
|
flavor = {
|
|
flavor = {
|
|
github: {
|
|
github: {
|
|
omitExtraWLInCodeBlocks: true,
|
|
omitExtraWLInCodeBlocks: true,
|
|
@@ -225,16 +226,39 @@ showdown.resetOptions = function () {
|
|
*/
|
|
*/
|
|
showdown.setFlavor = function (name) {
|
|
showdown.setFlavor = function (name) {
|
|
'use strict';
|
|
'use strict';
|
|
- if (flavor.hasOwnProperty(name)) {
|
|
|
|
- var preset = flavor[name];
|
|
|
|
- for (var option in preset) {
|
|
|
|
- if (preset.hasOwnProperty(option)) {
|
|
|
|
- globalOptions[option] = preset[option];
|
|
|
|
- }
|
|
|
|
|
|
+ if (!flavor.hasOwnProperty(name)) {
|
|
|
|
+ throw Error(name + ' flavor was not found');
|
|
|
|
+ }
|
|
|
|
+ var preset = flavor[name];
|
|
|
|
+ setFlavor = name;
|
|
|
|
+ for (var option in preset) {
|
|
|
|
+ if (preset.hasOwnProperty(option)) {
|
|
|
|
+ globalOptions[option] = preset[option];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+/**
|
|
|
|
+ * Get the currently set flavor
|
|
|
|
+ * @returns {string}
|
|
|
|
+ */
|
|
|
|
+showdown.getFlavor = function () {
|
|
|
|
+ 'use strict';
|
|
|
|
+ return setFlavor;
|
|
|
|
+};
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * Get the options of a specified flavor. Returns undefined if the flavor was not found
|
|
|
|
+ * @param {string} name Name of the flavor
|
|
|
|
+ * @returns {{}|undefined}
|
|
|
|
+ */
|
|
|
|
+showdown.getFlavorOptions = function (name) {
|
|
|
|
+ 'use strict';
|
|
|
|
+ if (flavor.hasOwnProperty(name)) {
|
|
|
|
+ return flavor[name];
|
|
|
|
+ }
|
|
|
|
+};
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Get the default options
|
|
* Get the default options
|
|
* @static
|
|
* @static
|
|
@@ -780,7 +804,12 @@ showdown.Converter = function (converterOptions) {
|
|
* @private
|
|
* @private
|
|
* @type {{}}
|
|
* @type {{}}
|
|
*/
|
|
*/
|
|
- listeners = {};
|
|
|
|
|
|
+ listeners = {},
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * The flavor set in this converter
|
|
|
|
+ */
|
|
|
|
+ setConvFlavor = setFlavor;
|
|
|
|
|
|
_constructor();
|
|
_constructor();
|
|
|
|
|
|
@@ -1104,16 +1133,26 @@ showdown.Converter = function (converterOptions) {
|
|
* @param {string} name
|
|
* @param {string} name
|
|
*/
|
|
*/
|
|
this.setFlavor = function (name) {
|
|
this.setFlavor = function (name) {
|
|
- if (flavor.hasOwnProperty(name)) {
|
|
|
|
- var preset = flavor[name];
|
|
|
|
- for (var option in preset) {
|
|
|
|
- if (preset.hasOwnProperty(option)) {
|
|
|
|
- options[option] = preset[option];
|
|
|
|
- }
|
|
|
|
|
|
+ if (!flavor.hasOwnProperty(name)) {
|
|
|
|
+ throw Error(name + ' flavor was not found');
|
|
|
|
+ }
|
|
|
|
+ var preset = flavor[name];
|
|
|
|
+ setConvFlavor = name;
|
|
|
|
+ for (var option in preset) {
|
|
|
|
+ if (preset.hasOwnProperty(option)) {
|
|
|
|
+ options[option] = preset[option];
|
|
}
|
|
}
|
|
}
|
|
}
|
|
};
|
|
};
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * Get the currently set flavor of this converter
|
|
|
|
+ * @returns {string}
|
|
|
|
+ */
|
|
|
|
+ this.getFlavor = function () {
|
|
|
|
+ return setConvFlavor;
|
|
|
|
+ };
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* Remove an extension from THIS converter.
|
|
* Remove an extension from THIS converter.
|
|
* Note: This is a costly operation. It's better to initialize a new converter
|
|
* Note: This is a costly operation. It's better to initialize a new converter
|