(folderPath: string)
| 85 | } |
| 86 | |
| 87 | function normalizeRelativeFolderPath(folderPath: string): string { |
| 88 | const slashNormalizedPath = folderPath.replace(/\\/g, "/"); |
| 89 | const preserveTrailingSlash = slashNormalizedPath.endsWith("/"); |
| 90 | const normalizedSegments: string[] = []; |
| 91 | |
| 92 | for (const segment of slashNormalizedPath.split("/")) { |
| 93 | if (!segment || segment === ".") { |
| 94 | continue; |
| 95 | } |
| 96 | |
| 97 | if (segment === "..") { |
| 98 | normalizedSegments.pop(); |
| 99 | continue; |
| 100 | } |
| 101 | |
| 102 | normalizedSegments.push(segment); |
| 103 | } |
| 104 | |
| 105 | const normalizedPath = normalizedSegments.join("/"); |
| 106 | return preserveTrailingSlash && normalizedPath ? `${normalizedPath}/` : normalizedPath; |
| 107 | } |
| 108 | |
| 109 | function stripMarkdownExtension(path: string): string { |
| 110 | return path.replace(/\.md$/i, ""); |
no outgoing calls
no test coverage detected