MCPcopy
hub / github.com/marktext/marktext / isMarkdownFile

Function isMarkdownFile

packages/desktop/src/common/filesystem/paths.ts:54–62  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

52 * Returns true if the path is a markdown file or symbolic link to one.
53 */
54export const isMarkdownFile = (filepath: string): boolean => {
55 if (!isFile2(filepath)) return false
56
57 if (isSymbolicLink(filepath)) {
58 const targetPath = path.resolve(path.dirname(filepath), fs.readlinkSync(filepath))
59 return isFile(targetPath) && hasMarkdownExtension(targetPath)
60 }
61 return hasMarkdownExtension(filepath)
62}
63
64/**
65 * Check if the both paths point to the same file.

Callers 2

file.tsFile · 0.90
normalizeMarkdownPathFunction · 0.90

Calls 6

isFile2Function · 0.90
isSymbolicLinkFunction · 0.90
isFileFunction · 0.90
resolveMethod · 0.80
dirnameMethod · 0.80
hasMarkdownExtensionFunction · 0.70

Tested by

no test coverage detected