BibNotes Formatter: New Plugin to Export and Format Annotations from Zotero into Obsidian

the thing is that i used the zotero native reader and have the annotation note (in html) in zotero but it don’t get imported. I guess i need to update it somehow because when i created the note the first time it had no annotations

I would check two things:

    1. have the annotations been exported in the json file?
    1. if so, the content of the json file seems to be cached by Obsidian, so in order to import new changes I have to close and re-open Obsidian
1 Like

i think reopening obsidian did the trick, i think i was restarting zotero instead of it.


P.S. I think it is not a bad idea to add a refresh database button or something. reopening obsidian every time is going to be annoying

P.S2. it also doesn’t deletes removed annotations

Thanks. I agree that a refresh button would be helpful. At the moment, I do not know how to do that but I will look for advice on this.

Regarding the deleting of the annotations, this is by default. I have set it up so that when you update a literature note (or the entire library), new annotations that were missing from the local note are added but the existing ones are not deleted/overwritten to avoid deleting/overwriting something that I had added to the note manually. I could change the default or create the option to simply over-write the note if it makes sense for somebody.

1 Like

yes i understand the danger of that option, but certainly it is useful. Just need to warn people when they activate that option and leave it inactive by default.

1 Like

Good idea. I will do that.

1 Like

Regarding the collection, I have added two placeholders:

  • {{collections}}: this will extract only the actual folders where where the entry is located, not their parent folders
  • {{collectionsParent}}: this will extract only the actual folders where where the entry is located plus two levels up.
    Are you looking for only one level up? I add the option for that

To carry over the information from zotfile regarding the settings for all colour you can either let zotfile do the job (and leave the settings within Bibtex as they are now) or do this:

  • restore the default settings in zotfile “extensions.zotfile.pdfExtraction.colorCategories”. This will make Zotfile export the name of the colour and Bibtex will be able to recognise and manipulate the colour.
  • in the settings of Bibtex you can add the custom text you want for each colour around the {{highlight}} placeholder. For instance "#important {{highlighlight}} will add the #important tag before highlights of that colour.

Currently the highlight settings that are specific to a colour do not override the general highlight settings (e.g. italic, bold). I can add the possibility of overriding those if this is helpful

@stpag is there a way to specify the folder by a variable? like rootvault/{{citeKey}}? It doesn’t work for me. I think it makes sense because it is importing raw material from zotero and they are going to be other notes beside it in this folder and there should be a MoC as the main note not navigate between them.

also using ( in the title somehow ignore for me when i test it.

Are you referring to the folder where the notes will be exported? It is not possible at the moment as I built it around my workflow which involves collecting all the literature notes into the same folder. But it is certainly possible to programmatically change the export path based on some value.

What value would be helpful? The example you mentioned (rootvault/{{citeKey}}) would lead to a different folder to be created for each entry since the citeKey is unique. That would generate hundreds if not thousands of folders. Maybe the option of exporting the note into folders that mirror the structure of Zotero’s folder?

1 Like

Yes I think citeKey is best option. I already use it to store my Epub/MD books. I prefer this method because it is also how Zotero store its library on Harddrive. then I link the book/paper in related Topics (like how it is in Zotero also). Maybe it is not the best solution but this kind of structure give me some space to fall back to when I am trying rearrange my MoC notes, otherwise it is a real headache for me.

i was actually looking for such a feature. where is this setting? I couldn’t find such a setting even in Bibtex advanced settings

It’s “extensions.zotfile.pdfExtraction.colorCategories”. It is detailed here: Zotero -> zotfile -> mdnotes -> obsidian -> dataview Workflow - #61 by OXHusky
You will need to access the settings from Zotero Advanced Config

1 Like

i already have this set up. but can’t find what you are saying and i was double confused because you said it was in Bibtex settings not zotfile.

btw, it would be awesome if you can a setting to import zotfile categorized by color notes by their order of color rather than mixing them again. if they get into separate notes like how mdnote does it it would be even better

Can you post a screenshot of the type of final output you have in mind?

it think as long as it keeps the grouping by color it is not that essential but i am thinking of something like this which creates all these notes in the same folder:

but if it is not practical i think just keeping annotation in different section of the main note like this:


1 Like

I like this idea! Perhaps a “group by color” toggle in the settings could be added if this feature is added to the plugin? But I would personally prefer to have them in the same note.
But perhaps, the colours could be a placeholder, so that we can easily set in the custom template where each colored highlight goes?

For example, I could highlight all the method sections in red, all the references I want to check in green, and all the results in yellow.
Then the template could have the following placeholders:

### Method

### Results

### References

Thank you @stpag for this plugin.

Regarding updating the changing the contents of notes.

" If a note already exists, its content will be updated without over-writing the existing annotation (e.g. comments added manually from within Obsidian and block-references will not be over-written)"
What exactly is protected during the update?
For example, if I write in the note, between highlights, and update the note, I imagine this will be erased?
But in the template, can I create a section called “summary” for example, write stuff in this heading, and then update the extracted notes, and the summary will not be affected? (I test this and it did not work. My text got erased as if the template was reapplied).

I also noticed that when updating the note, some characters got erased.

I noticed that the underscores from the citekeys were removed from the name of the file.

Could you make a short video of your workflow and how you use your plugin (if you have the time) ? It would be really useful for me to see exactly what we can edit in obsidian and what we should only edit in Zotero :slight_smile:

1 Like

I like this idea. It should be feasible (meaning, within my limited coding expertise). I have added it to my todo list


Here is how the plugin works when it comes to updating an existing note.

  1. The metadata is replaced so any change to any field will need to be made in Zotero. This is not safeguarded. If you want to add a “summary section” that should not be over-written, this would need to be in the “Extracted Annotation”. I can see this may not work for your use-case, so I may need to think about an alternative.

  2. The code them process the annotations. It identifies the text of the highlight or of the code, and looks whether any segment of that text (length depends on the length of the whole text) is already in the note. If a match is found, then the existing version of that highlight/comment is kept. If a match is not found, then this is regarded as a new comment/highlight and it is added in the text, after the last match found.

In practice this means that if you correct typos, add [[]], or add comments to any existing highlight, this will not be replaced/updated. If you want it to be replaced/updated, then remove it completely from the existing note and run the plugin.