Rename

PesudoCode

renameNote(oldLoc, newLoc) {
    oldNote := oldLoc
    newNote := newLoc

    oldVault := oldLoc
    oldNote :=
    ...
    notesChangedEntries = getNotesWithLinkTo(oldNote)

    info "notesWithLinkTo:gather", notes

    notesChanged = notesChangedEntries.map note {
        processNoteChangedByRename(note)

    }
    ...
}

processNoteChangedByRename(note) {
    foundLinks = findLinks(note, oldLoc)
    allLinks = foundLinks

    // filter out invalid header links
    if (
        oldLoc.fname = newLoc.fname &&
        oldLoc.vaultName = newLoc.vaultName &&
        oldLoc.anchorHeader && newLoc.anchorHeader
    ) {
        #todo
        ...
    }
    allLinks.filter link {
        oldLocVaultName = oldLoc.vaultName
        explicitlySameVault := (link.to.vaultName = oldLocVaultName)
        oldLocVault :=
        implicitlySameVault = !link.to.vaultName &&
            note.vault = oldLocVault
    }

    // update link
    updateLink(note, ...)

}

Past Work


Backlinks