So I have a vignette, vignettes/test-vignette3.Rmd
:
---
title: "Sample Document"
output:
html_document:
highlight: kate
theme: spacelab
toc: yes
pdf_document:
toc: yes
---
Header
=========
When I hit the knit HTML
button, I get the following:
processing file: test-vignette3.Rmd
output file: test-vignette3.knit.md
Output created: /tmp/RtmpKVpegL/preview-5ef42271c0d5.dir/test-vignette3.html
However, if I copy this file to inst/doc
and hit the knit HTML
button, I get:
processing file: test-vignette3.Rmd
output file: test-vignette3.knit.md
Output created: test-vignette3.html
My questions are:
knit HTML
on vignettes/test-vignette3.Rmw
to the vignettes directory?test-vignette3.knit.md
during the knit HTML
procedure? (I'd like to have the .md so people can read it on my github repo.)I'm running RStudio version 0.98.836, rmarkdown version 0.1.98 and knitr version 1.5.
To download the knitted HTML, go to the Files tab (lower right corner, same pane as Plots and Help) and select the checkbox next to your document's name. Make sure it is the HTML file with the same filename as the Rmd file you were editing. Then click the More button and select Export.
To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.
To knit in RStudio , click the Knit pull down button. You want to use the Knit HTML option for this lesson. When you click the Knit HTML button, a window will open in your console titled R Markdown. This pane shows the knitting progress.
Actually you should not keep the .html output under vignettes/
, because the vignette output is supposed to be generated by R CMD build
. R may fail to recompile your vignettes if the HTML output files have already been there when you build the source package, which means you are likely to see old (and possibly wrong) results because the HTML file was not generated from the latest version of the .Rmd
file. Therefore RStudio intentionally avoid writing the HTML files in the vignetttes directory.
If you choose to ignore the warning above, you can certainly run rmarkdown::render('your-vignette.Rmd')
in the R console.
For the second question, I do not recommend you to do that, either, because Github renders the markdown to HTML differently (compared to the Pandoc conversion done through the rmarkdown package). Normally the package vignettes are shown on CRAN, see, for example, the knitr page on CRAN. However, because the rmarkdown package is not on CRAN yet, you cannot use the vignette engine knitr::rmarkdown
at the moment (I guess we are not too far away from the CRAN release now). You can consider pushing the HTML files to Github pages, though.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With