File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 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) {
4040 let filename = path . basename ( pathname , '.md' )
4141 let splitPath = pathname . split ( path . sep )
4242
43- if ( ignoreFiles . indexOf ( filename ) = == - 1 ) {
44- nodeName = '- [' + filename + '](' + pathname + ')' + os . EOL
43+ if ( ignoreFiles . indexOf ( filename ) ! == - 1 ) {
44+ return true
4545 }
4646
47+ nodeName = '- [' + toCamelCase ( filename ) + '](' + pathname + ')' + os . EOL
48+
4749 if ( splitPath . length > 1 ) {
4850 if ( splitPath [ 0 ] !== lastPath ) {
4951 lastPath = splitPath [ 0 ]
50- tree += os . EOL + '- ' + splitPath [ 0 ] + os . EOL
52+ tree += os . EOL + '- ' + toCamelCase ( splitPath [ 0 ] ) + os . EOL
5153 }
5254
5355 tree += ' ' + nodeName
@@ -78,3 +80,9 @@ function getDirFiles(dir, callback) {
7880 }
7981 } )
8082}
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