Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Update Citekeys like Obsidian Does for Wikilinks #400

Open
Servinjesus1 opened this issue Dec 12, 2024 · 0 comments
Open

FR: Update Citekeys like Obsidian Does for Wikilinks #400

Servinjesus1 opened this issue Dec 12, 2024 · 0 comments

Comments

@Servinjesus1
Copy link

I make judicious use of Obsidian's ability to rename links across my Vault when refactoring my text.

The same often occurs with citations as my paper pile expands. Collisions, updates to my citation key format, etc require the frequent update of citation keys. But, when this happens, all old keys are obsolete. This makes the process of maintaining connections between literature notes challenging because the relations between papers and my notes are lost when the citekeys change.

Context: My Notetaking Strategy

Literature Notes produced by Zotlit act as waystones between Zotero and Obsidian and I do not change them manually. Instead, notes I take on literature live elsewhere, and distilled versions of these notes (paper notes) live in their locations, both linking back to the same Zotlit note. Using the pandoc citation style is great because it both converts to LaTeX well and I love Zotlit's ability to interpret it as a link to the Zotlit note.

However, this doesn't update if the Zotero database renames a citation key.

Idea: Citekey maintenance and Updating similar to Obsidian

As I understand it, Obsidian tracks notes internally with its own uuid strategy and thus when an update to a name occurs inside Obsidian, it can perform renaming across all links and references. Luckily we have a similar uuid in the zotero id for each citation, and so I can imagine that Zotlit could track these ids and their references across the Vault to perform citekey updating for any links. The nice thing is this could be done even if citekeys were changed with Obsidian closed, if Zotlit keeps a cached mapping of ids to citekeys and checks them on sync with Zotero.

Granted this is grandly simplifying the logic and complexity of adding such a feature, particularly since Zotlit is dependent on the Zotero database and API (e.g. what if a zotero ID changes?). Nor do I really know how Obsidian manages its rather seamless link updating capabilities.

Current Behavior

Currently when a citekey changes I observe the following:

  • The note and link remain working with the old citekey, nothing is manually updated and the update to the Zotero database does not affect Zotlit's ability to look up citekeys in pandoc format and link back to the note. This may be due to it checking for the existence of files with the correct name or citekey property. Testing is unclear how this works:
    • If I update the citekey property the link still appears to work, but once the filename is updated the link breaks. Returning the file to the proper name doesn't fix the link, only when the citekey returns to the proper value does the link resume working. Maybe this means the filename rename forced an update of the zotlit database?
  • Inserting a new markdown citation with the new key works (citekey is updated in zotlit's database enough to print the updated key in the selector), but attempting to open the new file produces a NoteExistsError:
Uncaught (in promise) NoteExistsError: Note linked to KULUXH4F already exists: <file>.md
    at pE.createNoteForDocItem (plugin:zotlit:361:29647)
    at pE.createNoteForDocItemFull (plugin:zotlit:361:30408)
    at async eval (plugin:zotlit:361:32375)
  • This error is "silent" in that I have to open developer tools to see it, otherwise the UI doesn't react. The existing file link continues to work.
  • Deleting the old file fixes the issue, but of course, now any remaining links to this file produce a "not found in Zotero" popup

Workaround Strategy/Alternatives

The other strategy would be to use wikilinks. I'm thinking of doing something like [cite:: [[Citekey]]] so dataview can track citations in a given note. Since I'd have to manually write a translator to convert wikilinks to citations in other languages, might as well make it distinct and utilize dataview anyway.

I haven't written this filter yet and would probably opt to attempt a Longform (js) filter before a pandoc (lua) one, but either way that's another customization step that has to be done. Adding a feature to update citekeys in zotlit would be an incredibly appreciated alternative.

Alternative 1: Vault Scanner

A simple command that scans all citekeys in the Vault and compares them against Zotero might be a helpful first step. If it finds a link that doesn't appear to exist in Zotero, a simple popup of the citekey name just like what happens when you try clicking on a broken citekey would at least allow me to fullsearch for all references to that citekey name and update them manually (tedious albeit doable)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant