1.0.10 • Published 6 years ago

markdown-it-vanilla-loader v1.0.10

Weekly downloads
82
License
Apache-2.0
Repository
github
Last release
6 years ago

CircleCI branch Codecov branch npm npm

Install

yarn add -D markdown-it-vanilla-loader

Usage

Input

# Your Markdown File

With some content.

webpack.config.js

module.exports = {
  module: {
    rules: [
      {
        test: /\.md$/,
        use: [
          'html-loader',
          {
            loader: 'markdown-it-vanilla-loader',
            options: {
              highlight: (code, language) => {
                return language && highlightjs.getLanguage(language)
                  ? highlightjs.highlight(language, code).value
                  : code;
              }
            }
          }
        ]
      }
    ]
  }
};

Output

<h1>Your Markdown File</h1>

<p>With some content.</p>

Options

This loader accepts any options that are allowed on markdown-it, those options can be found here.

NameTypeDefaultDescription
plugins{array}[]Plugins to load into markdown-it

plugins

Plugins can be defined in 2 ways.

  1. Just a string with no options.
  2. An array where the first item is the plugin name and the second item is an object with options for that plugin.

webpack.config.js

{
  loader: 'markdown-it-vanilla-loader',
  options: {
    plugins: [
      // Just a string
      'markdown-it-anchor',
      // Array with options
      [
        'markdown-it-anchor',
        {
          permalink: true,
          permalinkSymbol: '',
          level: 2
        }
      ]
    ]
  }
}

Example

cd example
yarn
yarn build
1.0.10

6 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.5

6 years ago

1.0.4

6 years ago

1.0.1

6 years ago