Converting Markdown to HTML5 slides via Pandoc through knitr in R

吃可爱长大的小学妹 提交于 2020-01-22 15:56:08

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!