我发现了这个很棒的教程,介绍如何修改在 Rstudio 中使用 markdown 和 knit 创建的 HTML 报告的 css 格式。帖子可以找到here http://nsaunders.wordpress.com/2012/08/27/custom-css-for-html-generated-using-rstudio/.
我希望以这个概念为基础并模仿页面的布局here http://www.seas.harvard.edu/courses/cs281/通过使用相同的CSS。我尝试简单地复制/粘贴/组合查看页面源代码时找到的两个 css 文件。
您能提供的任何帮助将不胜感激!这是我第一次尝试做任何 CSS 事情。
这是RStudio提供的方法:http://www.rstudio.com/ide/docs/authoring/markdown_custom_rendering http://www.rstudio.com/ide/docs/authoring/markdown_custom_rendering
options(rstudio.markdownToHTML =
function(inputFile, outputFile) {
require(markdown)
markdownToHTML(inputFile, outputFile, stylesheet='custom.css')
}
)
我从来没能让它正常工作,所以我做了一点不同的事情:
我通过创建标准输出文件,然后将标头和 css 代码放在 R 的顶部来完成此操作:
tmp <- readLines("your.html")
tmp <- tmp[-c(1:50)] # or however many lines it is before the css ends
write(tmp,"your.html")
然后我使用 pandoc 在独立文件中添加我自己的 css
system("pandoc -s -S your.html -c your.css -o output.html")
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)