import fs from 'node:fs'; const base='work/trilium/scoped/doc_notes/en'; const paths=JSON.parse(fs.readFileSync('work/trilium/docs-list.json')); const rows=paths.map(p=>({path:p,content:fs.readFileSync(base+'/'+p,'utf8')})).sort((a,b)=>a.content.length-b.content.length); const start=Number(process.argv[2]||0),count=Number(process.argv[3]||30); for(const [index,row]of rows.slice(start,start+count).entries())console.log('\n### '+(start+index)+' '+row.path.replaceAll('\\','/')+'\n'+row.content); fs.writeFileSync('work/trilium/docs-order.json',JSON.stringify(rows.map(r=>r.path.replaceAll('\\','/')),null,2));