Error: pandoc document conversion failed with error 2 with pkgdown / rmarkdown

Error: pandoc document conversion failed with error 2 with pkgdown / rmarkdown

我正在尝试用 pkgdown 建立一个网站,所以我 运行 pkgdown::build_site().

这将引发以下错误:

Building article 'index.html'

Error: pandoc document conversion failed with error 2

SO 上有类似的 problem 但答案没有解决我的问题。

我的猜测是问题出在 my vignette 的 header,目前是:

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.4\rmarkdown\rmd\h\default.html" --highlight-style pygments --css "C:\Users\E\Documents\R\win-library.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 将 header 更改为:

output:
  html_document: 
    smart: false

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

Pandoc 是 2.0 版。 sessionInfo() returns:

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