MCPcopy Create free account
hub / github.com/ZenNotes/zennotes / resolveWikilinkTarget

Function resolveWikilinkTarget

apps/desktop/src/main/wikilink-rename.ts:70–80  ·  view source on GitHub ↗
(
  notes: RenameNoteRef[],
  target: string
)

Source from the content-addressed store, hash-verified

68}
69
70export function resolveWikilinkTarget(
71 notes: RenameNoteRef[],
72 target: string
73): RenameNoteRef | null {
74 const visible = notes.filter((note) => note.folder !== 'trash')
75 if (isPathLikeWikilinkTarget(target)) {
76 return resolveExplicitPath(visible, target) ?? resolvePathSuffix(visible, target)
77 }
78 const needle = normalizeForCompare(stripMdExtension(target))
79 return visible.find((note) => normalizeForCompare(note.title) === needle) ?? null
80}
81
82/** Split `[[ ... ]]` inner text into target, `#heading`/`^block` anchor, and
83 * `|alias` — the anchor/alias keep their leading delimiter so the link can be

Callers 2

updateInboundWikilinksFunction · 0.90

Calls 5

isPathLikeWikilinkTargetFunction · 0.70
resolveExplicitPathFunction · 0.70
resolvePathSuffixFunction · 0.70
normalizeForCompareFunction · 0.70
stripMdExtensionFunction · 0.70

Tested by

no test coverage detected