@@ -33,7 +33,7 @@ const processor = unified()
3333 // add `v-pre` for code blocks
3434 . use (
3535 ( ) =>
36- function transformer ( tree ) {
36+ function transformer ( tree ) {
3737 const pres = select ( tree , 'element[tagName=pre]' )
3838 pres . forEach ( pre => {
3939 const { children, properties } = pre
@@ -55,25 +55,29 @@ const processor = unified()
5555const compileTemplate = require ( './compileTemplate' )
5656const styleInjectFile = join ( __dirname , 'styleInject.js' )
5757
58- module . exports = function process ( path , option , callback ) {
58+ module . exports = function process ( path , option , callback ) {
5959 if ( typeof option === 'function' ) {
6060 callback = option
6161 }
6262
6363 const file = vfile . readSync ( path )
6464 file . userOption = option
6565 // 与 vuepress-plugin-playground 整合
66- file . contents = file . contents . toString ( ) . replace ( / ` ` ` ( h t m l | v u e ) \s + @ ( p l a y g r o u n d | d e m o ) \s / g, m => {
67- return m . replace ( / @ ( p l a y g r o u n d | d e m o ) / , '' )
68- } )
69- processor . process ( file , function ( err , file ) {
66+ file . contents = file . contents
67+ . toString ( )
68+ . replace ( / ` ` ` ( h t m l | v u e ) \s + @ ( p l a y g r o u n d | d e m o ) \s / g, m => {
69+ return m . replace ( / @ ( p l a y g r o u n d | d e m o ) / , '' )
70+ } )
71+ processor . process ( file , function ( err , file ) {
7072 if ( err ) {
7173 return callback ( err )
7274 }
7375
7476 if ( file ) {
7577 const { components, styles } = file . data
76- const content = `<article class="markdown-body">${ file . contents } </article>`
78+ const content = `<article class="markdown-body">${
79+ file . contents
80+ } </article>`
7781 const { render, staticRenderFns } = compileTemplate ( content )
7882
7983 file . extname = '.js'
0 commit comments