Created
December 9, 2025 12:36
-
-
Save sdwvit/dbc2989d17654f8919f22314122d9fc2 to your computer and use it in GitHub Desktop.
Fill up nav sections with next up links
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const walk = (a, index = 0, parent = null) => | |
| a.forEach((e, i, arr) => { | |
| const fullpath = `~/ag-grid/documentation/ag-grid-docs/src/content/docs/${e.path}/index.mdoc`; | |
| let f = fs.readFileSync(fullpath).toString(); | |
| let next = arr[i + 1]; | |
| if (e.children) { | |
| next = e.children[0]; | |
| walk(e.children, i, arr); | |
| } | |
| if (!next && parent && parent[index + 1]) { | |
| next = parent[index + 1]; | |
| } | |
| if (!f.includes('## Next up') && next) { | |
| f += `## Next Up | |
| Continue to the next section: [${next.title}](./${next.path}/). | |
| `; | |
| fs.writeFileSync(fullpath, f); | |
| } | |
| }); | |
| walk([ | |
| { | |
| type: 'item', | |
| title: 'Configuration', | |
| path: 'configuration', | |
| children: [ | |
| { type: 'item', title: 'Column Definitions', path: 'column-definitions' }, | |
| { type: 'item', title: 'Updating Definitions', path: 'column-updating-definitions' }, | |
| { type: 'item', title: 'Column State', path: 'column-state' }, | |
| ], | |
| }, | |
| { type: 'item', title: 'Column Headers', path: 'column-headers' }, | |
| { type: 'item', title: 'Column Groups', path: 'column-groups' }, | |
| { type: 'item', title: 'Column Sizing', path: 'column-sizing' }, | |
| { type: 'item', title: 'Column Moving', path: 'column-moving' }, | |
| { type: 'item', title: 'Column Pinning', path: 'column-pinning' }, | |
| { type: 'item', title: 'Column Spanning', path: 'column-spanning' }, | |
| ]); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment