Bibtex key translator for Markdown (pandoc)
Hi,
I recently started writing a paper in Markdown with pandoc and a Zotero exported bibtex file. As I wanted to get the corresponding citation key directly from the Zotero ui I modified the transloator BibTeX-citep (https://forums.zotero.org/discussion/5094/) to output markdown citation keys: @key; @2ndkey; ...
You can find it here:
https://gist.github.com/liob/6009553
Instructions:
>> save the file to your Zotero translator's directory and restart Zotero.
>>
>> If you don't know where your translator's directory is: go to Zotero Preferences. Open the Advanced pane. Click on "Show Data Directory." This will take you to a "zotero" folder. The "zotero" folder will contain a "translators" folder. Save the.BibTexCiteKeyForMarkdown.js file here.
>>
>> After you restart Zotero, you can use the drag and drop functionality by going to the "Export" preferences pane and choosing "BibTeX key for Markdown" as the Default Output Format. Now, you can select a reference and drag it off the screen into a waiting text editor. Alternatively you can use Cmd+Shift+C to copy the @key to your clipboard.
Enjoy.
I recently started writing a paper in Markdown with pandoc and a Zotero exported bibtex file. As I wanted to get the corresponding citation key directly from the Zotero ui I modified the transloator BibTeX-citep (https://forums.zotero.org/discussion/5094/) to output markdown citation keys: @key; @2ndkey; ...
You can find it here:
https://gist.github.com/liob/6009553
Instructions:
>> save the file to your Zotero translator's directory and restart Zotero.
>>
>> If you don't know where your translator's directory is: go to Zotero Preferences. Open the Advanced pane. Click on "Show Data Directory." This will take you to a "zotero" folder. The "zotero" folder will contain a "translators" folder. Save the.BibTexCiteKeyForMarkdown.js file here.
>>
>> After you restart Zotero, you can use the drag and drop functionality by going to the "Export" preferences pane and choosing "BibTeX key for Markdown" as the Default Output Format. Now, you can select a reference and drag it off the screen into a waiting text editor. Alternatively you can use Cmd+Shift+C to copy the @key to your clipboard.
Enjoy.
For anyone using the Better BibTex/Better BibLatex (https://github.com/ZotPlus/zotero-better-bibtex) exporters, I've modified this code to output citations as `@Author1999`, to match Better BibLatex, rather than the original `@author_title_1999`.
https://gist.github.com/EoinTravers/50364a0db5b3bb22bc39
As far as I understand, BetterBibTeX already has this functionality integrated, so no need for a custom translator. See https://zotplus.github.io/better-bibtex/Citation-Keys.html#drag-and-drophotkey-citations
A related bug, I think, is that Zotero will export "$" as part of the citation key when it occurs in a title. pandoc barfs on this, as use of $ seems not to be recommended, if not a technical error.
(Didn't find an authoritative ref for that, just a bunch of comments here and there.)