Markdown + Highlight.js => HTML
npm install md-hl-loader -D
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
}
}
]
// ...
article.md
# Test
app.js
import article from './article.md'
import 'highlight.js/styles/github.css'
console.log(article) // '<h1>Test</h1>'