( pathname: string )
| 49 | * directory or markdown file. |
| 50 | */ |
| 51 | export const normalizeMarkdownPath = ( |
| 52 | pathname: string |
| 53 | ): { isDir: boolean; path: string } | null => { |
| 54 | const isDir = isDirectory2(pathname) |
| 55 | if (isDir || isMarkdownFile(pathname)) { |
| 56 | const resolved = normalizeAndResolvePath(pathname) |
| 57 | if (resolved) { |
| 58 | return { isDir, path: resolved } |
| 59 | } else { |
| 60 | console.error(`[ERROR] Cannot resolve "${pathname}".`) |
| 61 | } |
| 62 | } |
| 63 | return null |
| 64 | } |
| 65 | |
| 66 | /** |
| 67 | * Write the content into a file. |
no test coverage detected