MCPcopy
hub / github.com/marktext/marktext / normalizeMarkdownPath

Function normalizeMarkdownPath

packages/desktop/src/main/filesystem/markdown.ts:51–64  ·  view source on GitHub ↗
(
  pathname: string
)

Source from the content-addressed store, hash-verified

49 * directory or markdown file.
50 */
51export 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.

Callers 3

initMethod · 0.90
AppClass · 0.90
_listenForIpcMainMethod · 0.90

Calls 3

isDirectory2Function · 0.90
isMarkdownFileFunction · 0.90
normalizeAndResolvePathFunction · 0.90

Tested by

no test coverage detected