Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[markdownit] Add documentation how to set plugin options #15

Open
simonhermann opened this issue Feb 6, 2018 · 2 comments
Open

[markdownit] Add documentation how to set plugin options #15

simonhermann opened this issue Feb 6, 2018 · 2 comments

Comments

@simonhermann
Copy link

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}],
  ],
},
This question is available on Nuxt.js community (#c113)
@EmmanuelBeziat
Copy link

Agreed. I was trying to solve the problem too.

@janzheng
Copy link

janzheng commented Aug 23, 2018

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))
        }
      })
    }

@pi0 pi0 transferred this issue from nuxt-community/legacy-modules Dec 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants