4
votes

I'm trying to build a website with pkgdown so I ran pkgdown::build_site().

This throws the following error:

Building article 'index.html'

Error: pandoc document conversion failed with error 2

There was a similar problem on SO but the answer didn't solve my issue.

My guess was that the problem was in the header of my vignette which currently is:

output: 
  rmarkdown::html_vignette:
    smart: false
    toc: true

I tried changing it to:

output: rmarkdown::html_vignette

as it is used in the pkgdown's vignette. When I used that code, I got an error and the vignette did not build.

--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

I changed the header as suggested here to:

output:
  html_document: 
    smart: false

This header knits a vignette but I still get the same pandoc error when using build_site().

Pandoc is version 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

Any ideas how to fix it?

EDIT:

I ran the whole thing on Ubuntu and I managed to make it work (see the repo). Still don't know what was causing the issue. Here is the output of 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

1
Not sure the problem is with your vignette. I think the problem is with your README. Try using pkgdown::build_home() to see if you have the same error.F. Privé
I do get an error when using build_home() but I think it's the same underlying reason for both README and vignette. I built the website on Ubuntu, pulled the repo from GitHub to Windows, then tried to build a website again, but it failed.epo3
Try adding an h1 header (# some title) at the beginning of your README file.F. Privé
It still doesn't work. One way or another, it wouldn't explain why I managed to run it on Ubuntu, but not on Windows.epo3
Linux > Windows is the explanation. Unfortunately, I've no Windows computer at the moment to test your problem.F. Privé

1 Answers

2
votes

The warning is raised because the argument --smart is being used here: ... running command '"C:/PROGRA~2/Pandoc/pandoc" ... --smart ... "'. Because --smart/-S has been removed for Pandoc 2.0, that's a problem. So, remove --smart from the caller or command-line to fix this.

In Pandoc 2+, usage of smart is the same as for any other extension. To enable it, you append +smart to either the --to or the --from argument it, or possibly to both. And to disable, append -smart.

For example:

--to html+smart

Or maybe:

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