Skip to content

For converting old Obsidian literature notes to new citekey format

License

Notifications You must be signed in to change notification settings

samgalen/lit_note_converter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Convert Obsidian Literature Notes

This is a script I made to solve the following problem: I had a whole bunch of literature notes in my Obsidian vault, that had been generated using the Citations plugin for Obsidian. But! I made them from a bibtex file generated using vanilla Zotero. When I upgraded to the Better Bibtex, all of these notes were "lost".

For example, in my vault, I had literature notes with titles like @lokhov\_scalable\_2017 But, if I used any .bib file generated by Zotero with Better Bibtex, these notes

  1. wouldn't show up in the quick search
  2. would be duplicated if I created a new literature note without checking.
  3. links' to other notes would be lost

So I wrote this script to convert literature notes in one vault to another.

How to use it

In order to use this script you will need access to your old .bib file and your new .bib file.

There are two steps to using this script. First, it builds a map between the old bibfile, and the new bibfile. To do this run

python convert_old_notes.py vault_dir old_bib_file new_bib_file

Here vault_dir is the path to your Obsidian vault, old_bib_file is your previous .bib file, and new_bib_file is the .bib file with the update format.

This creates a JSON file called matches.json in your current directory. This is a best-guess mapping of old citekeys to new citekeys. Because Better Bibtex handles certain things like preserving and escaping formatting in a more sensible way than vanilla Zotero, this matching is approximate. You should look through the mapping and edit as appropriate.

I recommend making a backup of your vault before executing this next part. Once you are satisfied that matches.json is correct, you can execute

python convert_old_notes.py vault_dir old_bib_file new_bib_file --update-vault

If you want to preview the changes before committing to them, you can use the --dry-run flag, which will print out lines showing the changes.

About

For converting old Obsidian literature notes to new citekey format

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages