Complete website build including: - Build Your Kit store page with cart system, sectioned layout (Hardware, Software, Attachments, Spare Parts), inline quote request form, and sticky sidebar summary - 16+ pages: Education, Platform, Resources, News, About Us, Download, Contact, Rover, Code Editor, Robot Simulator, etc. - 89+ MDX resource articles and 18 news posts - Store product images scraped from micromelon.com.au - Quote request API route with Airtable integration - Dynamic back links and cover photos on resource pages - Redesigned downloads page - Fixed corrupted MDX code blocks
38 lines
1.3 KiB
JavaScript
38 lines
1.3 KiB
JavaScript
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`);
|