mirror of
https://github.com/usetrmnl/trmnl-picker.git
synced 2026-04-29 13:44:02 -07:00
Generate /doc using documentation.js; drop redundant docs from readme
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
/**
|
||||
* Automatically expand all accordion elements in documentation navigation
|
||||
*/
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
|
||||
const docsIndexPath = path.join(__dirname, '../doc/index.html');
|
||||
|
||||
if (!fs.existsSync(docsIndexPath)) {
|
||||
console.error('Error: doc/index.html not found');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
let html = fs.readFileSync(docsIndexPath, 'utf8');
|
||||
|
||||
// Remove 'display-none' from all toggle-target elements (handles both single and double quotes, and different class orderings)
|
||||
html = html.replace(/class=['"]([^'"]*\s)?display-none\s+toggle-target([^'"]*)['"]/g, "class='$1toggle-target$2'");
|
||||
html = html.replace(/class=['"]([^'"]*\s)?toggle-target\s+display-none([^'"]*)['"]/g, "class='$1toggle-target$2'");
|
||||
|
||||
// Change the toggle icon from ▸ (collapsed) to ▾ (expanded)
|
||||
html = html.replace(/<span class='icon'>▸<\/span>/g, "<span class='icon'>▾</span>");
|
||||
|
||||
fs.writeFileSync(docsIndexPath, html);
|
||||
|
||||
console.log('✓ Expanded all navigation accordions in documentation');
|
||||
Reference in New Issue
Block a user