1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-15 15:50:06 +02:00
copilot/legacy/ui/docs/webpack/embed-markdown-loader/src/index.js
Sérgio Ramos 8295bd6882 chore: initial lerna setup
this shall be a progressive process
2017-05-25 10:56:50 +01:00

29 lines
646 B
JavaScript

const loaderUtils = require('loader-utils');
const parse = require('./parse');
const hl = require('./highlight');
module.exports = function(source) {
const fn = this.async();
const config = loaderUtils.getLoaderConfig(this, 'embed-markdown-loader');
const fullname = loaderUtils.getRemainingRequest(this);
const mode = config.mode || 'shadow';
parse({
mode,
fullname,
source,
config: {
webpack: {
instantiated: this._compilation.options,
fullpath: config.webpackConfigFullpath
},
renderer: {
html: true,
breaks: true,
highlight: hl
}
}
}, fn);
};