title: Leaflet in RStudio: content is static for RHTML documents, dynamic for RMarkdown
body: <p>I'm trying to create some maps using leaflet in RStudio. I can get the dynamic maps working when I knit a RMarkDown document such as:</p>
  
  <pre><code>---
  title: "Map00"
  output: html_document
  ---
  
  ```{r setup, include=FALSE}
  knitr::opts_chunk$set(echo = TRUE)
  ```
  
  ## A Map
  
  ```{r}
  library(leaflet)
  m &lt;- leaflet()
  m &lt;- addTiles(m)
  m &lt;- addMarkers(m, lng=174.768, lat=-36.852, popup="The birthplace of R")
  m
  ```
  </code></pre>
  
  <p>But when I knit a RHTML version of the same map such as (same R code, just pasted it into boilerplate RHTML template):</p>
  
  <pre><code>&lt;html&gt;
  
  &lt;head&gt;
  &lt;title&gt;Map01&lt;/title&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  
  &lt;!--begin.rcode fig.width=7, fig.height=6
  library(leaflet)
  m &lt;- leaflet()
  m &lt;- addTiles(m)
  m &lt;- addMarkers(m, lng=174.768, lat=-36.852, popup="The birthplace of R")
  m
  end.rcode--&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>I get a static version of the map.</p>
  
  <p>The HTML files generated are also very different: the Markdown version generates for me a 1.2Mb file, with javascript on it. The HTML version just points to a local file in the <code>figure</code> folder.</p>
  
  <p>I guess it is an issue with knit -- any hints on how to solve it?</p>
  
  <p>thanks</p>