File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ async function fetchFile(route, file) {
4242
4343async function joinFiles ( ) {
4444 await fs . mkdir ( BUILD_DIR , { recursive : true } ) ;
45+ // TODO: Remove HTML from description with replaceAll
4546 for ( const [ llmsFile , files ] of Object . entries ( FILES_ROUTES ) ) {
4647 const contents = await Promise . all (
4748 files . map ( ( route ) => fetchFile ( route , llmsFile ) ) ,
@@ -52,7 +53,16 @@ async function joinFiles() {
5253 }
5354}
5455
56+ async function sanitizeFile ( filePath ) {
57+ const content = await fs . readFile ( filePath , 'utf8' ) ;
58+ const sanitizedContent = content . replace ( / < [ ^ > ] * > / g, '' ) ; // Remove HTML tags
59+ await fs . writeFile ( filePath , sanitizedContent , 'utf8' ) ;
60+ console . log ( `Sanitized ${ filePath } ` ) ;
61+ }
62+
5563joinFiles ( ) . catch ( ( err ) => {
5664 console . error ( 'Failed to join LLMs files:' , err ) ;
5765 process . exit ( 1 ) ;
5866} ) ;
67+
68+ Object . keys ( FILES_ROUTES ) . forEach ( ( llmsFile ) => sanitizeFile ( path . join ( BUILD_DIR , llmsFile ) ) ) ;
You can’t perform that action at this time.
0 commit comments