MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / getFileInsertText

Function getFileInsertText

src/suggest/FileSuggestHelper.ts:40–49  ·  view source on GitHub ↗
(plugin: TaskNotesPlugin, file: TFile)

Source from the content-addressed store, hash-verified

38}
39
40function getFileInsertText(plugin: TaskNotesPlugin, file: TFile): string {
41 if (file.extension === "md") {
42 const linktext = plugin.app.metadataCache.fileToLinktext?.(file, "", true);
43 if (typeof linktext === "string" && linktext.trim()) {
44 return linktext;
45 }
46 return file.basename;
47 }
48 return file.name || file.path.split("/").pop() || file.basename;
49}
50
51function normalizeFolderPath(folder: string): string {
52 return folder.trim().replace(/\\/g, "/").replace(/^\/+/, "").replace(/\/+$/, "");

Callers 1

runFunction · 0.85

Calls 1

fileToLinktextMethod · 0.80

Tested by

no test coverage detected