File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change @@ -69,7 +69,17 @@ async function fetchPageContent(
6969 const html = await response . text ( ) ;
7070 const dom = new JSDOM ( html ) ;
7171 const contentElement = dom . window . document . querySelector ( "#mw-content-text" ) ;
72- contentElement ?. querySelector ( ".t-navbar" ) ?. remove ( ) ;
72+
73+ const selectorsToRemove = [
74+ ".t-navbar" ,
75+ ".t-example-live-link" ,
76+ "editsection" ,
77+ "#toc" ,
78+ ] ;
79+ for ( const selector of selectorsToRemove ) {
80+ const elements = contentElement ?. querySelectorAll ( selector ) ;
81+ elements ?. forEach ( ( el ) => el . remove ( ) ) ;
82+ }
7383 const headingElement = dom . window . document . querySelector ( "#firstHeading" ) ;
7484 if ( ! contentElement ) {
7585 throw new Error ( "Could not find #mw-content-text" ) ;
@@ -423,7 +433,13 @@ async function main() {
423433 console . log ( ` 写入 ${ filePath } ` ) ;
424434 await writeMDXFile ( filePath , mdx , title ) ;
425435
426- console . log ( ` 尝试构建...` ) ;
436+ console . log ( ` 重新格式化...` ) ;
437+ spawnSync ( `npm` , [ "run" , "format" ] , {
438+ stdio : "inherit" ,
439+ shell : true ,
440+ } ) ;
441+
442+ console . log ( ` 构建...` ) ;
427443 const res = spawnSync ( `npm` , [ "run" , "build" ] , {
428444 stdio : "inherit" ,
429445 shell : true ,
You can’t perform that action at this time.
0 commit comments