title: How to replicate Knit HTML in a command line?
body: <p>I know this question is similar to <a href="https://stackoverflow.com/questions/11275255/knit2html-not-replicating-functionality-of-knit-html-button-in-r-studio">this</a> one. But I couldn't get a solution there so posting it here again.</p>
  
  <p>I want to get the exact same output as I get by clicking "Knit HTML" but via a command. I tryied using knit2html but it messes with the formatting and does not include the title, kable does not work etc.</p>
  
  <p>Example:</p>
  
  <p>This is my test.Rmd file,</p>
  
  <pre><code>---
  title: "test"
  output: html_document
  ---
  
  This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see &lt;http://rmarkdown.rstudio.com&gt;.
  
  When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
  
  ```{r}
  library(knitr,quietly=T)
  kable(summary(cars))
  ```
  
  You can also embed plots, for example:
  
  ```{r, echo=FALSE}
  plot(cars)
  ```
  
  Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
  </code></pre>
  
  <p>Output:</p>
  
  <p><strong>Knit HTML</strong></p>
  
  <p><img src="https://i.stack.imgur.com/OMR5w.jpg" alt="enter image description here"></p>
  
  <p><strong>knit2html</strong></p>
  
  <p><img src="https://i.stack.imgur.com/DCkMJ.jpg" alt="enter image description here"></p>