我想使用CDN的Bootstrap CSS(http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css)创建一个Rmarkdown。
我试图这样做,但它没有效果......
这就是我尝试的(我试过没有使用NULL,没有""也是,但我有同样的错误)
---
title: "Habits"
output:
html_document:
theme: NULL
highlight: NULL
css: "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
---
产生的错误是:
"E:/Program Files/R/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS teste.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output teste.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\diego\Documents\R\win-library\3.2\rmarkdown\rmd\h\default.html" --css "http:\\maxcdn.bootstrapcdn.com\bootstrap\3.3.6\css\bootstrap.min.css" --mathjax --variable "mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --no-highlight
output file: teste.knit.md
pandoc.exe: Could not fetch http:\\maxcdn.bootstrapcdn.com\bootstrap\3.3.6\css\bootstrap.min.css
InvalidUrlException "http:%5C%5Cmaxcdn.bootstrapcdn.com%5Cbootstrap%5C3.3.6%5Ccss%5Cbootstrap.min.css" "URL must be absolute"
Error: pandoc document conversion failed with error 67
Besides that: Warning message:
command execution '"E:/Program Files/R/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS teste.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output teste.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\diego\Documents\R\win-library\3.2\rmarkdown\rmd\h\default.html" --css "http:\\maxcdn.bootstrapcdn.com\bootstrap\3.3.6\css\bootstrap.min.css" --mathjax --variable "mathjax-url:https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML" --no-highlight' teve status 67
Execution interrupted
有一种方法可以引用具有绝对路径的在线CSS吗?
谢谢,
答案 0 :(得分:3)
来自Rmarkdown Github成员@jjallaire:
不支持css选项的外部网址,但您可以这样做:
---
title: "Habits"
output:
html_document:
theme: NULL
highlight: NULL
---
<style type="text/css">
@import url("http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css");
</style>
—
EDITED: 我在Rmarkdown页面上找到的另一个解决方案:
---
title: "Habits"
output:
html_document:
theme: flatly
highlight: tango
---
来自Bootstrap,并且有引导样式。