r - 错误 : pandoc document conversion failed with error 2 with pkgdown/rmarkdown

标签 r yaml r-markdown pandoc r-package

我正在尝试使用 pkgdown 建立一个网站所以我跑了pkgdown::build_site() .

这会引发以下错误:

Building article 'index.html'

Error: pandoc document conversion failed with error 2



有一个类似的 problem在 SO 上,但答案并没有解决我的问题。

我的猜测是问题出在 my vignette 的标题中目前是:
output: 
  rmarkdown::html_vignette:
    smart: false
    toc: true

我尝试将其更改为:
output: rmarkdown::html_vignette

因为它用于 pkgdown 的 vignette .当我使用该代码时,出现错误并且小插图没有构建。

--smart/-S has been removed. Use +smart or -smart extension instead. For example: pandoc -f markdown+smart -t markdown-smart. Try pandoc.exe --help for more information. Error: pandoc document conversion failed with error 2 In addition: Warning message: running command '"C:/PROGRA~2/Pandoc/pandoc" +RTS -K512m -RTS Introduction.utf8.md --to html --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash --output pandoc23e071f76af6.html --smart --email-obfuscation none --self-contained --standalone --section-divs --template "C:\Users\E\Documents\R\win-library\3.4\rmarkdown\rmd\h\default.html" --highlight-style pygments --css "C:\Users\E\Documents\R\win-library\3.4\rmarkdown\rmarkdown\templates\html_vignette\resources\vignette.css" --mathjax --variable "mathjax-url:https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"' had status 2 Execution halted



我按照建议更改了标题 here到:
output:
  html_document: 
    smart: false

这个标题编织了一个小插图,但在使用 build_site() 时我仍然遇到相同的 pandoc 错误.

Pandoc 是 2.0 版。 sessionInfo()返回:

R version 3.4.1 (2017-06-30) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale:

LC_COLLATE=English_United Kingdom.1252 LC_CTYPE=English_United Kingdom.1252 LC_MONETARY=English_United Kingdom.1252 LC_NUMERIC=C
LC_TIME=English_United Kingdom.1252

attached base packages: stats graphics grDevices utils
datasets methods base

other attached packages: pkgdown_0.1.0.9000 devtools_1.13.2

loaded via a namespace (and not attached): MASS_7.3-47
compiler_3.4.1 magrittr_1.5 R6_2.2.2 tools_3.4.1
withr_1.0.2 roxygen2_6.0.1 Rcpp_0.12.12 memoise_1.1.0 xml2_1.1.1 stringi_1.1.5 stringr_1.2.0 digest_0.6.12
commonmark_1.2 rlang_0.1.1.9000



任何想法如何解决它?

编辑:

我在 Ubuntu 上运行了整个程序,并设法让它工作(参见 repo)。仍然不知道是什么导致了这个问题。这是 sessionInfo() 的输出:

R version 3.3.3 (2017-03-06) Platform: x86_64-pc-linux-gnu (64-bit) Running under: Ubuntu 16.04.2 LTS

locale:

LC_CTYPE=en_GB.UTF-8 LC_NUMERIC=C
LC_TIME=en_GB.UTF-8 LC_COLLATE=en_GB.UTF-8
LC_MONETARY=en_GB.UTF-8 LC_MESSAGES=en_GB.UTF-8
LC_PAPER=en_GB.UTF-8 LC_NAME=C LC_ADDRESS=C
LC_TELEPHONE=C LC_MEASUREMENT=en_GB.UTF-8 LC_IDENTIFICATION=C

attached base packages: stats graphics grDevices utils
datasets methods base

other attached packages: pkgdown_0.1.0.9000 devtools_1.13.1

loaded via a namespace (and not attached): MASS_7.3-45
magrittr_1.5 R6_2.2.2 tools_3.3.3 withr_2.0.0
roxygen2_6.0.1 Rcpp_0.12.12 memoise_1.1.0 xml2_1.1.1
stringi_1.1.2 stringr_1.2.0 digest_0.6.12 commonmark_1.2 rlang_0.1.1

最佳答案

引发警告是因为参数 --smart在这里使用:... running command '"C:/PROGRA~2/Pandoc/pandoc" ... --smart ... "' .因为 --smart/-S has been removed对于 Pandoc 2.0,这是一个问题。因此,删除 --smart从调用者或命令行来解决这个问题。

在 Pandoc 2+ 中, smart 的用法与任何其他扩展相同。要启用它,请附加 +smart--to--from争论它,或者可能两者都争论。要禁用,请附加 -smart .

例如:

--to html+smart



或者可能:

--from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-smart

关于r - 错误 : pandoc document conversion failed with error 2 with pkgdown/rmarkdown,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45339538/

相关文章:

html - 使用 rvest 访问 html 表

r - R Shiny应用程序中的执行延迟

r - 如何在year_month面板数据中生成滞后变量

r - 在knitr中指定多种同时输出格式(新)

java - "Mapping keys are not allowed here"当我在 yaml 文件中使用 '?' 字符时。我怎样才能使程序可以使用 '?' 字符?

r - 使用 pandoc 和 RStudio Markdown 转换为 MS Word 的语法是什么?它如何用于包含引用书目和内联引用?

r - 在受限环境中使用 `rmarkdown::render`

r - 如何从字符列表中生成随机单词?

azure - 无法访问 AKS 上 LoadBalancer 类型的 Kubernetes 服务

r - 如何抑制 HTML 文件的下载进度