diff --git a/lib/commands/generate.js b/lib/commands/generate.js index 9326c24..eb43fbc 100644 --- a/lib/commands/generate.js +++ b/lib/commands/generate.js @@ -36,7 +36,7 @@ function genSidebar(cwdPath, sidebarPath) { let nodeName = '' getDirFiles(cwdPath, function (pathname) { path.relative(pathname, cwdPath) - pathname = pathname.replace(cwdPath + '/', '') + pathname = pathname.replace(cwdPath + path.sep, '') let filename = path.basename(pathname, '.md') let splitPath = pathname.split(path.sep) @@ -44,7 +44,7 @@ function genSidebar(cwdPath, sidebarPath) { return true } - nodeName = '- [' + toCamelCase(filename) + '](' + pathname + ')' + os.EOL + nodeName = '- [' + toCamelCase(filename) + '](' + pathname.replace(/\\/g, '/') + ')' + os.EOL if (splitPath.length > 1) { if (splitPath[0] !== lastPath) {