问题
Since version 1.2 knitr
has a new function pandoc
to convert markdown document to other formats via pandoc directly in R
(See here). For example
library(knitr)
pandoc('foo.md', format='html') # HTML
I wonder how to convert Markdown document (See knitr-slides.md for MWE) to HTML5
slides. Thanks
回答1:
First, add the following to your .Rmd
document:
<!--pandoc
s:
S:
i:
mathjax:
-->
Then use the command
library(knitr)
knit("foo.Rmd")
pandoc("foo.md", format="dzslides")
This will still create the file foo.html
, but will use the pandoc command
pandoc -s -S --mathjax -f markdown -t dzslides -o foo.html 'foo.md'
to create it, which will result in the output being in HTML5 slides.
来源:https://stackoverflow.com/questions/16487822/converting-markdown-to-html5-slides-via-pandoc-through-knitr-in-r