Parses source as Markdown using the awesome markdown-it parser. And do some additional great stuff with it.
This is a fork of the original markdown-it-loader
. This one is made to allow a deeper access and control of the output.
$ npm install --save markdown-it-loader
In your webpack.config.js
file:
var subscript = require('markdown-it-sub');
var superscript = require('markdown-it-sup');
module.exports = {
module: {
loaders: [{
test: /\.md/,
loader: 'markdown-it'
}]
},
'markdown-it': {
preset: 'default',
typographer: true,
use: [subscript, superscript]
}
};
All the options you pass through the markdown-it
key are actually forwarded to markdown-it
itself. There are, however, three exceptions:
use
: A list of plugins that should be used.preprocess
: A function which gets the source to parse and an environment object. This very object is passed to markdown-it as well. A user may use this function to strip out front-matter and the like.postprocess
: This callback receives only the parser and environment object. It must return the finalized environment object, as that is the one which is set as the exports of the resulting JavaScript.
function preprocess(MarkdownIt, Environment, Source) -> String
- Context: Loader context
function postprocess(MarkdownIt, Environment) -> Any
- Whatever this function returns, becomes the module's
module.exports
property. - Context: Loader context
- Code:
git clone git://github.com/DragonsInn/markdown-it-plus-loader.git
- Home: https://github.com/DragonsInn/markdown-it-plus-loader/
- Original author: Daniel Perez Alvarez (unindented@gmail.com)
- Fork by: Kevin Ingwersen (Ingwie Phoenix) (ingwie2000@gmail.com)
Copyright (c) 2014 Daniel Perez Alvarez (unindented.org). This is free software, and may be redistributed under the terms specified in the LICENSE file.