MCPcopy Index your code
hub / github.com/callumalpass/tasknotes / isImplicitTaskLinkDisplayText

Function isImplicitTaskLinkDisplayText

src/editor/taskLinkDisplayText.ts:58–89  ·  view source on GitHub ↗
(
	displayText: string | undefined,
	taskPath: string | undefined,
	linkPath?: string,
	taskTitle?: string
)

Source from the content-addressed store, hash-verified

56}
57
58export function isImplicitTaskLinkDisplayText(
59 displayText: string | undefined,
60 taskPath: string | undefined,
61 linkPath?: string,
62 taskTitle?: string
63): boolean {
64 const normalizedDisplay = normalizePathLikeLabel(displayText) || normalizeSubpathLabel(displayText);
65 if (!normalizedDisplay || !taskPath) return false;
66
67 const normalizedTaskPath = normalizePathLikeLabel(taskPath);
68 const normalizedLinkPath = normalizePathLikeLabel(linkPath);
69 const candidates = new Set<string>([
70 normalizedTaskPath,
71 basename(normalizedTaskPath),
72 ]);
73
74 if (normalizedLinkPath) {
75 candidates.add(normalizedLinkPath);
76 candidates.add(basename(normalizedLinkPath));
77 }
78
79 const normalizedSubpath = extractTaskLinkSubpath(linkPath);
80 if (normalizedSubpath) {
81 candidates.add(normalizedSubpath);
82 const formattedSubpath = formatTaskLinkSubpathDisplayText(taskTitle, normalizedSubpath);
83 if (formattedSubpath) {
84 candidates.add(formattedSubpath);
85 }
86 }
87
88 return candidates.has(normalizedDisplay);
89}
90
91export function resolveTaskLinkDisplayText(
92 displayText: string | undefined,

Calls 6

normalizePathLikeLabelFunction · 0.85
normalizeSubpathLabelFunction · 0.85
basenameFunction · 0.85
extractTaskLinkSubpathFunction · 0.85
hasMethod · 0.80

Tested by

no test coverage detected