File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -817,6 +817,7 @@ This is a fully client-side application. Your content never leaves your browser
817817 function isMarkdownPath ( path ) {
818818 return / \. ( m d | m a r k d o w n ) $ / i. test ( path || "" ) ;
819819 }
820+ const MAX_GITHUB_FILES_SHOWN = 30 ;
820821
821822 function getFileName ( path ) {
822823 return ( path || "" ) . split ( "/" ) . pop ( ) || "document.md" ;
@@ -958,20 +959,20 @@ This is a fully client-side application. Your content never leaves your browser
958959
959960 let targetPath = files [ 0 ] ;
960961 if ( files . length > 1 ) {
961- const maxShown = Math . min ( files . length , 30 ) ;
962+ const maxShown = Math . min ( files . length , MAX_GITHUB_FILES_SHOWN ) ;
962963 const choices = files
963964 . slice ( 0 , maxShown )
964965 . map ( ( file , index ) => `${ index + 1 } . ${ file } ` )
965966 . join ( "\n" ) ;
966967 const choice = prompt (
967- `Found ${ files . length } Markdown files.\nEnter a number to import:\n\n${ choices } ${ files . length > maxShown ? "\n..." : "" } ` ,
968+ `Found ${ files . length } Markdown files.\nEnter a number to import (showing first ${ maxShown } ) :\n\n${ choices } ${ files . length > maxShown ? "\n..." : "" } ` ,
968969 "1"
969970 ) ;
970971
971972 if ( choice === null ) return ;
972973 const selectedIndex = Number ( choice ) - 1 ;
973974 if ( ! Number . isInteger ( selectedIndex ) || selectedIndex < 0 || selectedIndex >= maxShown ) {
974- throw new Error ( `Please enter a number between 1 and ${ maxShown } .` ) ;
975+ throw new Error ( `Please enter a number between 1 and ${ maxShown } (from the displayed list) .` ) ;
975976 }
976977 targetPath = files [ selectedIndex ] ;
977978 }
You can’t perform that action at this time.
0 commit comments