markdown-loader
Version:
markdown-loader for webpack
83 lines (65 loc) • 2.43 kB
Markdown
markdown-loader
===============
markdown-loader for webpack using [marked](https://github.com/markedjs/marked).
[](https://www.npmjs.com/package/markdown-loader)
[](https://packagephobia.now.sh/result?p=markdown-loader)
[](https://www.npmjs.com/package/markdown-loader)
[](https://david-dm.org/peerigon/markdown-loader)
[](https://travis-ci.org/peerigon/markdown-loader)
`npm install markdown-loader`
Since marked's output is HTML, it's best served in conjunction with the [html-loader](https://github.com/webpack/html-loader).
```javascript
{
module: {
rules: [{
test: /\.md$/,
use: [
{
loader: "html-loader"
},
{
loader: "markdown-loader",
options: {
/* your options here */
}
}
]
}]
}
}
```
Pass your marked [options](https://marked.js.org/#/USING_ADVANCED.md#options) as shown above.
In order to specify [custom renderers](https://github.com/peerigon/markdown-loader/issues/5), set the `options.renderer`-option in your webpack config.
```javascript
// webpack.config.js
const marked = require("marked");
const renderer = new marked.Renderer();
return {
module: {
rules: [{
test: /\.md$/,
use: [
{
loader: "html-loader"
},
{
loader: "markdown-loader",
options: {
pedantic: true,
renderer
}
}
]
}]
}
}
```
MIT (http://www.opensource.org/licenses/mit-license.php)
[<img src="https://assets.peerigon.com/peerigon/logo/peerigon-logo-flat-spinat.png" width="150" />](https://peerigon.com)