Knitr and slidify interactions in RStudio

120 views Asked by At

I have recently loaded slidify into my RStudio environment and I get some strange results when trying to render R Markdown into HTML using the Knitr button.

When I first load RStudio and the Rmd (which contains no slidify markup, just normal document syntax), I can press the knitr button and it renders normally. The R markdown console appears in the R studio tab and the inbuilt browser opens up with the HTML.

However, when I press knitr a second time, the R markdown console pops open in a new window, and after processing, the inbuilt browser opens a blank document. Same for any subsequent press.

When I restart Rstudio, the behaviour resets and repeats above.

The html snippets are different in each case. Here is the beginning of the HTML for case 1 (the document rendering correctly:

<head>
<meta charset="utf-8">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="pandoc" />
<meta name="author" content="Chris Shaw" />
<meta name="date" content="2016-07-22" />
<title>Human Activity Recognition - Analysis of Weight Lifting Exercise</title>
<script src="data:application/x-      javascript;base64,LyohIGpRdWVyeSB2MS4xMS4zIHwgKGMpIDIwMDUsIDIwMTUgalF1ZXJ5IEZ vdW5kYXRpb24sIEluYy4gfCBqcXVlcnkub3JnL2xpY2Vuc2UgKi8KIWZ1bmN0aW9uKGEsYil7Im9iamVjdCI9PXR
 ..........

But this is the HTML that is generated the second time (the one that renders blank in the browser)

<head>
<title>Human Activity Recognition - Analysis of Weight Lifting Exercise</title>
<meta charset="utf-8">
<meta name="description" content="Human Activity Recognition - Analysis of Weight Lifting Exercise">
<meta name="author" content="Chris Shaw">
<meta name="generator" content="slidify" />
<meta name="apple-mobile-web-app-capable" content="yes">
<meta http-equiv="X-UA-Compatible" content="chrome=1">
<link rel="stylesheet"  href="http://slidifylibraries2.googlecode.com/git/inst/libraries/frameworks/io2012/css/default.css" media="all" >
<link rel="stylesheet" ref="http://slidifylibraries2.googlecode.com/git/inst/libraries/frameworks/io2012/css/phone.css" 
 media="only screen and (max-device-width: 480px)" >
 <link rel="stylesheet" href="http://slidifylibraries2.googlecode.com/git/inst/libraries/frameworks/io2012/css/slidify.css" >
 <link rel="stylesheet" href="http://slidifylibraries2.googlecode.com/git/inst/libraries/highlighters/highlight.js/css/tomorrow.css" />
 <base target="_blank"> <!-- This amazingness opens all links in a new tab. -->  
 <!-- Grab CDN jQuery, fall back to local if offline -->
 <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.min.js">    </script>

You can see that some slidify code has slipped into the HTML for some reason (there are no slidify commands in the document). Note that knit2html() works just fine over and over without restarting RStudio. It's only pressing the button that causes this to happen.

This only started when I installed slidify a couple of days ago.

I am using R studio version 0.99.903 and latest versions of knitr, slidify etc

0

There are 0 answers