mgmeyers / obsidian-zotero-integration

Insert and import citations, bibliographies, notes, and PDF annotations from Zotero into Obsidian.
GNU General Public License v3.0
1.02k stars 55 forks source link

Request: convert deep links to Obsidian native style... #242

Open olearydj opened 1 year ago

olearydj commented 1 year ago

I'm not sure if this is possible, but it would be great to convert the deep links generated by OZI into the new Obsidian native format. This would allow us to use the built-in PDF viewer after generating the original annotations. I think.

EvoAlg commented 1 year ago

Hi,

I followed the video by Danny Hatcher then used his template (my edited version shown below). You can put an Obsidian PDF link in as per line 16, then change the page number to Nunjucks variable for the annotations page out of Zotero, so in this case {{annotation.page}}.

image

When you import the annotations, you can see the Obsidian deep PDF link in line 23 (but only page deep). I show the pdf below by using Ctrl + cursor hover over the link (NOTE: the PDF is actually showing the next page 20 for some reason, so you may have to put a -1 in the template).

image

I need to work out the Nunjucks variable for the PDF name from Zotero, then put this into the template for the Deep Obsidian link as well. Obviously, I have to make sure the PDFs files name in Obsidian matches that in Zotero.

The last piece of the puzzle is trying to get the location out of the annotation object in the template so we could have a truly deep link like [[Linear+Algebra+Done+Right.pdf#page=19&selection=0,0,23,7]].

Below I show the output of the Zotero Data Explorer (its an Obsidian command in this plugin). The 3rd annotation (counted 2 from 0) you can see x & y coordinates in red. I have not been able to calibrate these to the Obsidian Deep link coordinates like &selection=0,0,23,7. I may be looking at he wrong thing here, I'm just trying stuff.

image
olearydj commented 1 year ago

This looks good, thank you! I will revisit it when I next spend some time improving my OZI template and related workflows.