Skip to content

Commit 03b210d

Browse files
committed
feat: Remove HTML
1 parent 016dd46 commit 03b210d

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/joinLlmsFiles.mjs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ async function fetchFile(route, file) {
4242

4343
async 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+
5563
joinFiles().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)));

0 commit comments

Comments
 (0)