|
|
@ -212,7 +212,7 @@ function MarkdownIt(presetName, options) { |
|
|
|
|
|
|
|
|
|
|
|
this.options = {}; |
|
|
|
this.configure(config[presetName]); |
|
|
|
this.configure(presetName); |
|
|
|
|
|
|
|
if (options) { this.set(options); } |
|
|
|
} |
|
|
@ -254,9 +254,15 @@ MarkdownIt.prototype.set = function (options) { |
|
|
|
* will give better compatibility with next versions. |
|
|
|
**/ |
|
|
|
MarkdownIt.prototype.configure = function (presets) { |
|
|
|
var self = this; |
|
|
|
var self = this, presetName; |
|
|
|
|
|
|
|
if (!presets) { throw new Error('Wrong `markdown-it` preset, check name/content'); } |
|
|
|
if (utils.isString(presets)) { |
|
|
|
presetName = presets; |
|
|
|
presets = config[presetName]; |
|
|
|
if (!presets) { throw new Error('Wrong `markdown-it` preset "' + presetName + '", check name'); } |
|
|
|
} |
|
|
|
|
|
|
|
if (!presets) { throw new Error('Wrong `markdown-it` preset, can\'t be empty'); } |
|
|
|
|
|
|
|
if (presets.options) { self.set(presets.options); } |
|
|
|
|
|
|
|