1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-29 06:30:07 +02:00
copilot/ui/docs/webpack/embed-markdown-loader/src/index.js

29 lines
646 B
JavaScript
Raw Normal View History

2016-10-23 07:27:18 +03:00
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);
};