melat0nin / zotero-roam-export

A Zotero addon for exporting to Roam
MIT License
180 stars 14 forks source link

Quick Copy via Translator? #17

Closed linxule closed 4 years ago

linxule commented 4 years ago

Hi Laurence,

Thank you so much for making this Add-on!

Would you be able to provide some guidance as to how I can use your codes for a "translator" in Zotero? So it would be possible to use QuickCopy in Zotero to copy the output (in the format that is shown in Roam) in .txt or .md and paste into Roam. This would be great for quickly adding one or two articles to Roam.

I have tried to incorporate your codes into a couple of Zotero translators, but so far I have not made it work. Any tips will be appreciated!

melat0nin commented 4 years ago

Glad it's useful!

This addon actually came out of a translator, but translators only have limited access to the Zotero database so I had to refactor into a full addon. You can find the old translator code here: https://github.com/melat0nin/translators/blob/master/Roam%20JSON.js

Are you having trouble exporting just one or two items with the full addon? I guess that isn't Quick Copy, to be fair. It would probably make sense to adapt another translator to output MD for pasting...

linxule commented 4 years ago

Thank you for the prompt reply! Sorry that my original post was a bit confusing. The full addon works great for me. I was mainly wondering if it could be modified and used as QuickCopy and, like you said, output MD for pasting.

Relatedly, I was wondering if the JSON output can be fed directly to Alfred or ZotHero on Alfred so that JSON output can be parsed and formatted in MD. (Just a thought as I don't have enough knowledge on the topic.)

And thank you for the old translator code. I will give it a try!

melat0nin commented 4 years ago

I don't use Alfred or ZotHero so I can't comment on that. In terms of outputting to MD, this was requested elsewhere and I agree it would be useful, but I think it's a different project.

I guess it should be possible to use the translator framework to output to the clipboard rather than a file, but that will only be useful if what's copied is in MD/some other unformalised format, which brings us back to the point above. Quickcopying JSON wouldn't work because you'd be pasting that raw into Roam, which isn't much use.

I think for that reason I'll close this issue, since I think it's really a separate project.

linxule commented 4 years ago

Thank you, Laurence. Here is my attempt to just have Zotero write a couple of key info. Would love to learn more as to add additional information in the output, especially the "collections as topics".

melat0nin commented 4 years ago

"collections as topics"

I'm afraid that's precisely the thing that a translator can't access, and the main reason I moved to a full addon. It seems bizarre, but the translator code is sandboxed and can't access other parts of the Zotero database in the way an addon can 😢

linxule commented 4 years ago

Thanks for the explanation! Keep up the good work!