Die*_*ona 4 css r twitter-bootstrap knitr r-markdown
我想使用 CDN 中的 Bootstrap CSS 创建 Rmarkdown ( http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css )。
我正在尝试这样做,但没有成功......
这就是我尝试过的(我尝试不使用 NULL,也不使用“”,但我遇到了同样的错误)
---
title: "Habits"
output:
html_document:
theme: NULL
highlight: NULL
css: "http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"
---
Run Code Online (Sandbox Code Playgroud)
产生的错误是:
"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
Run Code Online (Sandbox Code Playgroud)
有什么方法可以用绝对路径引用在线CSS吗?
谢谢,
来自 Rmarkdown Github 成员@jjallaire:
\n\n不支持 css 选项的外部 URL,但您可以这样做:
\n\n---\ntitle: "Habits"\noutput:\n html_document:\n theme: NULL\n highlight: NULL\n---\n\n<style type="text/css">\n@import url("http://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css");\n</style>\n\xe2\x80\x94\nRun Code Online (Sandbox Code Playgroud)\n\n编辑:\n我在 Rmarkdown 页面上找到的另一个解决方案:
\n\n---\ntitle: "Habits"\noutput:\n html_document:\n theme: flatly\n highlight: tango\n---\nRun Code Online (Sandbox Code Playgroud)\n\n完全来自 Bootstrap 并具有 Bootstrap 样式。
\n| 归档时间: |
|
| 查看次数: |
1855 次 |
| 最近记录: |