1.1.1 • Published 6 years ago

md-hl-loader v1.1.1

Weekly downloads
1
License
ISC
Repository
github
Last release
6 years ago

md-hl-loader

Markdown + Highlight.js => HTML

Install

npm install md-hl-loader -D

Configuration

webpack basic

// ...
rules: [
  {
    test: /\.md$/,
    loader: 'md-hl-loader'
  }
]
// ...

with options

// ...
rules: [
  {
    test: /\.md$/,
    loader: 'md-hl-loader',
    // https://github.com/markdown-it/markdown-it#init-with-presets-and-options
    options: {
      markdownItOptions: {
        html: true
      },
      compileImages: true // compile images
    }
  }
]
// ...

Usage

article.md

# Test

app.js

import article from './article.md'
import 'highlight.js/styles/github.css'
console.log(article) // '<h1>Test</h1>'