/* 处理code */ module.exports = function codeWrapper(html) { const group = html.replace(/<\/pre>/g, ':::').split(':::'); const codeOnline = `
在线运行
`; return group .map(fragment => { if (fragment.indexOf('demo') !== -1) { return fragment.replace('

demo

', '') + codeOnline; } return fragment; }) .join(''); };