Skip to content

allow simple markdown plugin loading #585

Closed
@neumayr

Description

@neumayr

Feature request

What problem does this feature solve?

markdown.config currently requires a javascript function argument. This is only manageable with a config.js setup. I would like to allow markdown plugin loading also from a config.yml file.
Similar requests, see #326 & #579

What does the proposed API look like?

I would propose a markdown.plugins endpoint that requires an Array. See implementation example.

How should this be implemented in your opinion?

# .vuepress/config.yml
markdown:
  lineNumbers: true
  plugins:
    - ins
    - markdown-it-mark
// .vuepress/config.js
module.exports = {
  markdown: {
    lineNumbers: true,
    plugins: ['ins', 'markdown-it-mark']
  }
}
// vuepress/lib/markdown/index.js:58

  // apply user plugins
  if (markdown.plugins) {
    markdown.plugins.forEach(function (plugin) {
      plugin = plugin.replace('markdown-it-', '')
      md.use(require(`markdown-it-${plugin}`))
    })
  }

Are you willing to work on this yourself?

Yes 🎉 wip branch is alive

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: feature requestRequest to add a new featureversion: nextPlanned to do or already included in the next(1.0.0) version

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions