( notes: T[], current: Pick<NoteMeta, 'path'> )
| 145 | } |
| 146 | |
| 147 | export 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 | |
| 162 | export function extractWikilinkTargets(body: string): string[] { |
| 163 | const stripped = stripCodeContent(body) |
no test coverage detected