File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -40,14 +40,16 @@ function genSidebar(cwdPath, sidebarPath) {
40
40
let filename = path . basename ( pathname , '.md' )
41
41
let splitPath = pathname . split ( path . sep )
42
42
43
- if ( ignoreFiles . indexOf ( filename ) = == - 1 ) {
44
- nodeName = '- [' + filename + '](' + pathname + ')' + os . EOL
43
+ if ( ignoreFiles . indexOf ( filename ) ! == - 1 ) {
44
+ return true
45
45
}
46
46
47
+ nodeName = '- [' + toCamelCase ( filename ) + '](' + pathname + ')' + os . EOL
48
+
47
49
if ( splitPath . length > 1 ) {
48
50
if ( splitPath [ 0 ] !== lastPath ) {
49
51
lastPath = splitPath [ 0 ]
50
- tree += os . EOL + '- ' + splitPath [ 0 ] + os . EOL
52
+ tree += os . EOL + '- ' + toCamelCase ( splitPath [ 0 ] ) + os . EOL
51
53
}
52
54
53
55
tree += ' ' + nodeName
@@ -78,3 +80,9 @@ function getDirFiles(dir, callback) {
78
80
}
79
81
} )
80
82
}
83
+
84
+ function toCamelCase ( str ) {
85
+ return str . replace ( / \b ( \w ) / g, function ( match , capture ) {
86
+ return capture . toUpperCase ( )
87
+ } ) . replace ( / - | _ / g, ' ' )
88
+ }
You can’t perform that action at this time.
0 commit comments