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

Function backlinksForNote

packages/app-core/src/lib/wikilinks.ts:147–160  ·  view source on GitHub ↗
(
  notes: T[],
  current: Pick<NoteMeta, 'path'>
)

Source from the content-addressed store, hash-verified

145}
146
147export function backlinksForNote<T extends NoteRef & Pick<NoteMeta, 'wikilinks'>>(
148 notes: T[],
149 current: Pick<NoteMeta, 'path'>
150): T[] {
151 const out: T[] = []
152 for (const note of notes) {
153 if (note.folder === 'trash' || note.path === current.path) continue
154 if (!note.wikilinks?.length) continue
155 if (note.wikilinks.some((target) => resolveWikilinkTarget(notes, target)?.path === current.path)) {
156 out.push(note)
157 }
158 }
159 return out
160}
161
162export function extractWikilinkTargets(body: string): string[] {
163 const stripped = stripCodeContent(body)

Callers 1

StatusBarFunction · 0.90

Calls 1

resolveWikilinkTargetFunction · 0.70

Tested by

no test coverage detected