UNPKG

459 BJavaScriptView Raw
1const md = require('./marked');
2
3const renderer = new marked.Renderer();
4
5renderer.code = (code, lang) => {
6 return `<h1>code</h1>`;
7}
8
9function process(source) {
10 source = md(source, {renderer: renderer});
11 const res = JSON.stringify(source);
12 return res;
13}
14
15
16module.exports = function(source, map){
17 this.cacheable && this.cacheable();
18 //对source进行解析
19 var exports = process(source);
20 return "module.exports = " + exports;
21}
\No newline at end of file