External links don’t work in a document published to RPubs

See the source for this RPub

Using this cool tip to provide the source for this RPub! Although going there creates an Rpub-within-an-Rpub ….

UPDATE 2014-06-04: Earlier in May, Ramnath Vaidyanathan happened across this and reached out to clarify what’s wrong. External links using https:// don’t work, whereas those using http:// do. My original post to RStudio support is here (ha! of course that link doesn’t work on RPubs because it’s https://), where they acknowledge the problem and suggest a workaround. Namely, the proposal is to give such links a target = "_top" or target = "_blank" attribute to have them open correctly in the same page or in a new tab or window, respectively. Let’s test that with two hand-crafted links to my RStudio support post:

Link with target attribute set to "_top" for me, this opens correctly, in the same tab

Link with target attribute set to "_blank" for me, this opens correctly, in a new tab

Original RPub below here

This is an R Markdown document. It demonstrates an external link that, once HTML is published to RPubs, does nothing. All these links do work from the HTML preview I get within RStudio via the “Preview HTML” button.

I noticed this while marking for a course in which most students published their report to RPubs and placed code and data in public github repositories.

So I will use a github link as example.

Try to go here: https://github.com/jennybc/STAT545A

For me, on Mac OS 10.8.4 and in Safari 6.0.5, I must control click and open the link in a new tab. That does work.

For kicks, let me try the link in other ways. For me, I get same behavior as above.

  • How about in angle brackets? https://github.com/jennybc/STAT545A
  • How about a regualar Markdown link? https://github.com/jennybc/STAT545A

Here’s a non-github link: https://support.rstudio.com

Here’s a GIF Yihui used on his blog: http://i.imgur.com/vGwGF7s.gif

This GIF link does work. I think this has something to do with whether the link can be opened and embedded with the Rpubs framework (sorry, I don’t know the technical term for that).