import fs from 'fs'; import path from 'path'; import { fileURLToPath } from 'url'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); const dir = path.join(__dirname, '..', 'content', 'resources'); let fixed = 0; for (const f of fs.readdirSync(dir).filter(f => f.endsWith('.mdx'))) { const filepath = path.join(dir, f); const original = fs.readFileSync(filepath, 'utf8'); // Split frontmatter from content const secondDash = original.indexOf('---', 4); if (secondDash === -1) continue; const frontmatter = original.substring(0, secondDash + 3); let content = original.substring(secondDash + 3); // Fix broken bullet lists where "-" is on its own line followed by blank line then content // Pattern: line with just "-", blank line, then content text // Should become: "- content text" content = content.replace(/^- *\n\n(.+)/gm, '- $1'); // Also fix numbered lists with same pattern: "1." on own line, blank, content content = content.replace(/^(\d+)\. *\n\n(.+)/gm, '$1. $2'); // Clean up any resulting triple+ blank lines content = content.replace(/\n{3,}/g, '\n\n'); const result = frontmatter + content; if (result !== original) { fs.writeFileSync(filepath, result); fixed++;; console.log(` Fixed: ${f}`); } } console.log(`Fixed bullet lists in ${fixed} files`);