Skip to content

Commit cd8b02d

Browse files
committed
refactor: logically reorganize implementation guide sections using cheerio
1 parent b669c86 commit cd8b02d

4 files changed

Lines changed: 379 additions & 279 deletions

File tree

extract_structure.cjs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
const fs = require('fs');
2+
const content = fs.readFileSync('index.html', 'utf8');
3+
4+
const startIdx = content.indexOf('IMPLEMENTATION & REVIEW GUIDE');
5+
if (startIdx === -1) {
6+
console.error('Could not find IMPLEMENTATION section.');
7+
process.exit(1);
8+
}
9+
10+
const sectionContent = content.slice(startIdx);
11+
12+
const regex = /<(h[234]|summary)[^>]*>(.*?)<\/\1>/g;
13+
let match;
14+
console.log('--- IMPLEMENTATION GUIDE STRUCTURE ---');
15+
while ((match = regex.exec(sectionContent)) !== null) {
16+
const tag = match[1];
17+
let text = match[2].replace(/<[^>]+>/g, '').trim();
18+
if (tag === 'h2') console.log(`\n## ${text}`);
19+
else if (tag === 'h3') console.log(`\n### ${text}`);
20+
else if (tag === 'h4') console.log(`#### ${text}`);
21+
else if (tag === 'summary') console.log(` - ${text}`);
22+
}

0 commit comments

Comments
 (0)