Accepts Markdown as input, and outputs a module exporting the lexed Markdown using marked.
This loader does not render Markdown to HTML. There are already several loaders that do. This loader is intended to be used for processing Markdown as an AST.
module: {
rules: [{
test: /\.md$/,
use: {
loader: 'markdown-lexer-loader',
options: {
// All options are passed to marked, merging with marked’s defaults:
// https://github.com/chjj/marked#options-1
}
}]
}
options
are merged with marked’s default options and passed to marked.lexer(source, options)
.
See additional documentation on using loaders.
To give a better idea of what this loader does, the Markdown snippet
# Hello, world
This is some Markdown
turns into
export default [{"type":"heading","depth":1,"text":"Hello, world"},{"type":"paragraph","text":"This is some Markdown"}]
Tests are run with Jest:
npm install
npm test
Contributions are welcome! New features or bug fixes must include tests. Try to match existing code style, or better yet, add ESLint or Prettier to this project.