title: Show an R markdown chunk in the final output
body: <p>I am writing on a presentation using Knitr, Markdown and Slidify. The slides will be partly  deal with Knitr as topic which is the reason why I stumbeld upon a problem. I cannot include for example a knitr-markdown chunk to show it on the slide. It will always be interpreted on the first run even if I do something like this:  </p>
  
  <pre><code>```
  ```{r eval = F, include = T}
  
  ```
  ``` 
  </code></pre>
  
  <p>How can I prevent a chunk to be interpreted and thus removed from the final output so that I can show how a chunk is structured when using Markdown and Knitr?</p>
  
  <p>EDIT:</p>
  
  <p>I tried the version of you @Ramnath and made up te following slides: </p>
  
  <pre><code>## Testslide 1
  
  ```{r verbatimchunk, verbatim = TRUE}
  x = 1 + 1
  x
  ```
  
  ```{r regularchunk}
  x = 1 + 1
  x
  ```
  
  ---
  
  ## Testslide 2
  
  ```{r verbatimchunk_2, verbatim = TRUE}
  x = 1 + 1
  x
  ```
  
  * element 1
  * element 2
  
  ---
  
  ## Testslide 3
  
  * element 1
  * element 2
  
  
  ```{r verbatimchunk_3, verbatim = TRUE}
  x = 1 + 1
  x
  ```
  </code></pre>
  
  <p>The first two slides work fine but the last one is the problem. If there is a bullet list before the verbatim chunk, it is interpreted as usual. So it is the same as with the first solution from @Scott. I do not understand this. </p>
  
  <p>EDIT 2/3 (Working solution)</p>
  
  <pre><code>```{r echo = FALSE}
  require(knitr)
  hook_source_def = knit_hooks$get('source')
  knit_hooks$set(source = function(x, options){
    if (!is.null(options$verbatim) &amp;&amp; options$verbatim){
      opts = gsub(",\\s*verbatim\\s*=\\s*TRUE\\s*", "", options$params.src)
      bef = sprintf('\n\n    ```{r %s}\n', opts, "\n")
      stringr::str_c(bef, paste(knitr:::indent_block(x, "    "), collapse = '\n'), "\n    ```\n")
    } else {
       hook_source_def(x, options)
    }
  })
  ```
  
  ## Testslide
  
  * Element one
  * Element two
  
  
  Some text here breaks list environment:
  
  ```{r verbatim = T}
  any code
  ```
  </code></pre>