hans / obsidian-citation-plugin

Obsidian plugin which integrates your academic reference manager with the Obsidian editor. Search your references from within Obsidian and automatically create and reference literature notes for papers and books.
MIT License
1.08k stars 80 forks source link

FR: Copy pdf's to Obsidian vault for compatibility with obsidian-annotator #114

Open HEmile opened 3 years ago

HEmile commented 3 years ago

Is your feature request related to a problem? Please describe. I would like to be able to combine obsidian-citations with obsidian-annotator for annotating academic texts.

Describe the solution you'd like Workflow example:

  1. Add pdf + citation to Zotero (eg from Arxiv)
  2. Open the corresponding literature note in obsidian-citations
    1. The template could contain something like
      ---
      annotation-target: {{local-pdf}}
      ---
  3. Obsidian-citations copies the pdf file from the absolute path. Alternatively, it can download it from the {{URL}} parameter
  4. Start annotating the pdf using obsidian-annotator

This automates that workflow and ensures all data is self-contained in the Obsidian vault.

One problem here might be whether Obsidian is even allowed to copy this file as it is outside the vault.

Describe alternatives you've considered I currently have annotation-target: {{URL}}, which works, but has issues

  1. I prefer to have everything local and offline
  2. If eg on Arxiv a pdf gets replaced by the new version, the annotations are referring to an older version, causing issues.

Additionally, obsidian-annotator is not able open absolute files (eg using

---
{{#each entry.files}}
annotation-target: {{this}}
{{/each}}
---

will not work: The pdf is outside the vault).

hans commented 3 years ago

Hi, I wonder if this is better to fix in obsidian-annotator rather than fix here? Concretely, I can't think of use cases in which the ideal behavior would be to make copies of all files associated with citations into the vault.

In any case, AFAICS @HEmile 's suggested solution is technically possible -- we have read access to files outside the vault from the plugin.

Ping @elias-sundqvist -- what do you think about this?

elias-sundqvist commented 3 years ago

It is actually possible to access files outside the vault by using the file: protocol. See https://github.com/elias-sundqvist/obsidian-annotator/issues/16#issuecomment-908355666

HEmile commented 3 years ago

Oh, that is good to know @elias-sundqvist ! That's already a big help. However, the main use case I have is that I'd like to have my vault self-contained (ie, all PDF's are in the vault). This is because I use Obsidian sync regularly, and I'd like to sync the annotated pdf's with my tablet. That way, i can find literature on my pc and add them to the vault, highlight on my tablet, then process the highlights on my computer again.

HEmile commented 3 years ago

@hans I'm considering implementing this myself. Would you merge it in if I added it?