Skip to content

BuildBacklinksSnapshotParams<TPayload>

Params for buildBacklinksSnapshot.

Import:

import type { BuildBacklinksSnapshotParams } from '@mnaoumov/obsidian-lib/link';

Signature:

export interface BuildBacklinksSnapshotParams<TPayload>

Properties

PropertyTypeDescription
backlinksBacklinksLikeThe backlinks to record.
linkIdentityKeyProvider?(link: Reference) => stringComputes the identity key of a link.

The snapshot remembers it, so editBacklinksSnapshot looks the links up with the same function without being told. When BuildBacklinksSnapshotParams.target was built with a provider, omitting this reuses that one, and passing a different one throws: a snapshot keyed by two functions matches nothing.
pathRemapper?(backlinkPath: string) => stringRewrites the path of a backlink-holding note as it will be **after** the operation.

A note that holds a backlink can itself be renamed or moved by the same operation — including the renamed note's own self-links. Remapping here keys the snapshot by the path the rewrite will actually open.
payloadProvider(link: Reference) => TPayloadProduces the payload to record for a link. See BacklinksSnapshot for what a payload is for.
target?MutableBacklinksSnapshot<TPayload>An existing snapshot to merge into, so several sets of backlinks can be accumulated into one.

Merging is what makes a single rewrite pass per note possible when a note links to several moved targets: without it, calling the rewrite once per target would open — and write — the same note repeatedly.

When omitted, a new snapshot is created.

Links to this page: