@huiji/vue-markdown-loader

A webpack loader for loading markdown files as Vue Single-File Components
559 1
Install
npm install @huiji/vue-markdown-loader
Latest Version:1.0.3
License:MIT
Last Updated:Apr 10, 2019
Links: GitHub  ·  npm
Maintainer: duduluu

vue-markdown-loader

A webpack loader for loading markdown files as Vue Single-File Components, based on MarkdownIt

Features

  • supports all <script> and <style> types of Vue Single-File Components
  • auto convert internal links to Vue <router-link>
  • customize MarkdownIt options and additional plugins
  • insert anchor to headings (base on markdown-it-anchor)
  • custom container (base on markdown-it-container) TODO
  • front matter TODO
  • highlighting TODO

Usage

npm i -D @void/vue-markdown-loader

# or use yarn
yarn add -D @void/vue-markdown-loader

webpack

// webpack.config.js
const VueLoaderPlugin = require('vue-loader/lib/plugin');

module.exports = {
  resolve: {
    extensions: ['.js', '.jsx', '.vue', '.json', '.md'],
  },
  module: {
    rules: [
      {
        test: /\.md$/,
        use: [
          {
            loader: 'vue-loader',
          },
          {
            loader: '@void/vue-markdown-loader',
          },
        ],
      },
    ],
  },
  plugins: [new VueLoaderPlugin()],
};

vue-cli 3.0

// vue.config.js
module.exports = {
  chainWebpack: config => {
    config.resolve.extensions.merge(['.md']);

    config.module
      .rule('md')
      .test(/\.md$/)
      .use('vue-loader')
      .loader('vue-loader')
      .end()
      .use('@void/vue-markdown-loader')
      .loader('@void/vue-markdown-loader')
      .end();
  },
};

Related Packages

@nuxtjs/markdownit-loader

Webpack loader to translate markdown to HTML using markdownit.

325,518 11
markdownit-loader

Webpack loader to translate markdown to HTML using markdownit.

1,655 12
@mdit-vue/plugin-component

A markdown-it plugin to allow vue components in markdown

5,900,143 221
@mdit-vue/plugin-sfc

A markdown-it plugin to help transforming markdown to vue sfc

1,849,811 221
@mdit-vue/plugin-title

A markdown-it plugin to get markdown page title

1,813,201 221

Version History

Version Released License
1.0.3 MIT
1.0.2 MIT
1.0.1 MIT
1.0.0 MIT