@@ -48,9 +48,6 @@ function addFrontmatter(filePath, navOrder, parent = "", isIndex = false) {
48
48
if ( filePath === path . join ( DOCS_DIR , "index.md" ) ) {
49
49
// Root index.md → Home page
50
50
title = "Home" ;
51
- } else if ( isIndex ) {
52
- // Folder's index page → folder name
53
- title = prettify ( path . basename ( path . dirname ( filePath ) ) ) ;
54
51
} else {
55
52
// Regular file → file name
56
53
title = prettify ( baseName ) ;
@@ -155,7 +152,7 @@ function processDir(dir, startOrder = 1, parent = "") {
155
152
const fullPath = path . join ( dir , entry . name ) ;
156
153
157
154
if ( entry . isFile ( ) && entry . name . endsWith ( ".md" ) ) {
158
- const isIndex = entry . name . toLowerCase ( ) === "index .md" ;
155
+ const isIndex = entry . name . toLowerCase ( ) === "readme .md" ;
159
156
addFrontmatter ( fullPath , order ++ , isRoot ? "" : isIndex ? parent : currentTitle , isIndex ) ;
160
157
} else if ( entry . isDirectory ( ) ) {
161
158
// Root folders have no parent
@@ -167,7 +164,7 @@ function processDir(dir, startOrder = 1, parent = "") {
167
164
}
168
165
169
166
const ModuleTitle = "\n## Modules\n" ;
170
- const rootMdFile = path . resolve ( DOCS_DIR , "index .md" ) ;
167
+ const rootMdFile = path . resolve ( DOCS_DIR , "README .md" ) ;
171
168
let [ staticPart , moduleIndex ] = fs . readFileSync ( rootMdFile , "utf8" ) . split ( ModuleTitle ) ;
172
169
173
170
function flattenDirs ( dir , parent = "" ) {
@@ -203,6 +200,7 @@ function flattenDirs(dir, parent = "") {
203
200
// flatten docs output
204
201
flattenDirs ( DOCS_DIR ) ;
205
202
fs . writeFileSync ( rootMdFile , [ staticPart , moduleIndex ] . join ( ModuleTitle ) ) ;
203
+ fs . renameSync ( path . resolve ( DOCS_DIR , "README.md" ) , path . resolve ( DOCS_DIR , "index.md" ) ) ;
206
204
207
205
// Run script
208
206
processDir ( DOCS_DIR ) ;
0 commit comments