@@ -117,7 +117,7 @@ export const formatMarkdownBody = (container, selectors, options, exec) => {
117117    return  markdownBody 
118118} 
119119
120- const  extract  =  async  ( markdownBody ,  selectors ,  options ,  exec )  =>  { 
120+ const  extract  =  async  ( {   markdownBody,  selectors,  options,  exec,  hook  } )  =>  { 
121121    const  {  origin,  context,  localOptions =  { }  }  =  options 
122122    const  fileName  =  getText ( selectors . title )  ||  document . title 
123123    const  realName  =  fileName . replace ( / [ \\ \/ \? < > : ' \* \| ] / g,  '_' ) 
@@ -151,7 +151,7 @@ const extract = async (markdownBody, selectors, options, exec) => {
151151    } ,  localOptions . tpl ) 
152152    const  markdownDoc  =  html2markdown ( info  +  getMarkdown ( markdownBody ) ,  { } ) 
153153    const  copyright  =  formatCopyRight ( {  title : fileName ,  url : location . href  } ,  localOptions ) 
154-     const  content  =  await  exec ( 'formatContent' ,  {  markdownBody,  markdownDoc } ) 
154+     const  content  =  await  exec ( hook [ 'formatContent' ] ,   context ,  {  markdownBody,  markdownDoc } ) 
155155    files . push ( { 
156156        name : realName  +  '.md' , 
157157        content : `${ content  &&  typeof  content  ===  'string'  ? content  : markdownDoc } ${ copyright }  
@@ -178,7 +178,7 @@ export const downloadMarkdown = async (...rest) => {
178178    const  markdownBody  =  formatMarkdownBody ( container ,  selectors ,  options ,  exec ) 
179179    if  ( await  verify ( 'extract' ,  {  markdownBody } ) )  return  exec ( ) 
180180
181-     const  {  fileName,  files }  =  await  extract ( markdownBody ,  selectors ,  options ,  exec ) 
181+     const  {  fileName,  files }  =  await  extract ( {   markdownBody,  selectors,  options,  exec,  hook  } ) 
182182    if  ( await  verify ( 'afterExtract' ,  {  fileName,  files } ) )  return  exec ( ) 
183183
184184    return  { 
0 commit comments