Update 2017-11-30: Updates to Chrome in June 2017 broke this code by making alert text non-selectable. I’ve filed a bug report. Until if/when Google fixes this, I am now using this python script instead.


This blog is written in redcarpet markdown and I cite papers in PubMed a lot. I wanted a quick way to convert a PubMed link into a citation that I could paste into my posts. This is the best I’ve figured out so far - it takes a few steps and it’s not perfect.

For starters, make sure your bookmarks bar is showing. In Chrome:

How to show the bookmarks bar in Chrome

Or in Firefox:

How to show the bookmarks toolbar in Firefox

Then, drag both of these buttons onto your bookmarks bar:

Cite step 1

Cite step 2

(The original javascript for these buttons is here and here).

Now go to your favorite PubMed citation, for instance http://www.ncbi.nlm.nih.gov/pubmed/24699458 and click Cite step 1. This will load the plain text, minimalist version of the citation. Once the page has loaded, next click Cite step 2. This will (for most articles) parse it into a markdown “reference-style” link as described here, and show this text to you in an alert window. Highlight and copy the alert text, click OK to make it go away, and paste the text into the bottom of your post. If your text editor has good syntax highlighting for markdown, it should look something like this:

markdown citation example

The purple is the name you can use to reference the citation throughout your post; the white is the destination URL; and the yellow is the mouseover text, which I figure allows your reader to see the entire citation if they want to know what journal it’s in or something but don’t want to click through to PubMed.

For some journals (particularly Science), Cite step 2 often fails, and you end up wth the link and citation formatted properly but the link name (the purple part) is garbage. I haven’t figured out a cure-all for this so I just edit those manually. Then you can cite your reference anywhere in the document by simply referencing the name in brackets, for instance writing [Watts 2014] produces the link Watts 2014.