markdownit-module
markdownit-module copied to clipboard
[markdownit] Add documentation how to set plugin options
After searching for quite some time I finally figured out what the correct syntax is. I'd appreciate if you could add this to the readme:
markdownit: {
use: [
'plugin1',
['plugin2', {option1: true}],
],
},
Agreed. I was trying to solve the problem too.
It still throws an error if you try something like the following, but for some reason only on subsequent hot reloads. It seems to do fine on initial load...
use: [
['markdown-it-attrs', {
leftDelimiter: '[',
rightDelimiter: ']'
}],
I tracked down the error to markdownit-loader/lib/core.js
, and this seems to not crash:
parser = markdown(opts.preset, opts)
if (plugins) {
plugins.forEach(function (plugin) {
if (Array.isArray(plugin)) {
// plugin[0] = resolvePlugin(plugin[0])
// parser.use.apply(parser, plugin)
parser.use(resolvePlugin(plugin[0]), plugin[1])
} else {
parser.use(resolvePlugin(plugin))
}
})
}