Pkgdown: `build_site()` fails with pandoc 2 update

Created on 31 Oct 2017  Â·  7Comments  Â·  Source: r-lib/pkgdown

I updated pandoc with homebrew last night and am now getting an error when running build_site(). This looks to be related to the --smart flag in the rmarkdown::pandoc_convert() call in util.R.

Here's the error message:

--smart/-S has been removed.  Use +smart or -smart extension instead.
For example: pandoc -f markdown+smart -t markdown-smart.
Try pandoc --help for more information.
Error: pandoc document conversion failed with error 2

@yihui seems to have run into this with bookdown recently as well:
https://github.com/rstudio/rmarkdown/issues/1120

Most helpful comment

The problem is you used --smart in your code:
https://github.com/hadley/pkgdown/blob/2794e6247c8e4777550f12e329986c503688c6e3/R/util.r#L32-L43

I only fixed the issue in rmarkdown. You have to check rmarkdown::pandoc_available("2.0") and decide whether to use --smart or the +smart extension.

All 7 comments

Fix is documented in that issue

The problem is you used --smart in your code:
https://github.com/hadley/pkgdown/blob/2794e6247c8e4777550f12e329986c503688c6e3/R/util.r#L32-L43

I only fixed the issue in rmarkdown. You have to check rmarkdown::pandoc_available("2.0") and decide whether to use --smart or the +smart extension.

Oh got it.

There seems to be something else going on as well. I patched pkgdown to use +smart, but then running pkgdown::build_site() got

> pkgdown::build_news()
Building news -----------------------------------------------------------------
pandoc: +smart: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1

This is reproducible by creating a new package with CRAN devtools, and GitHub pkgdown.

> devtools::create("temp")
Creating package 'temp' in '/home/nacnudus/R'
No DESCRIPTION found. Creating with values:


Package: temp
Title: What the Package Does (one line, title case)
Version: 0.0.0.9000
Authors@R: person("Duncan", "Garmonsway", email = "[email protected]", role = c("aut", "cre"))
Description: What the package does (one paragraph).
Depends: R (>= 3.4.2)
License: What license is it under?
Encoding: UTF-8
LazyData: true
* Creating `temp.Rproj` from template.
* Adding `.Rproj.user`, `.Rhistory`, `.RData` to ./.gitignore
> setwd("temp")
> devtools::use_news_md()
* Creating `NEWS.md` from template.
* Modify `NEWS.md`.
> pkgdown::build_site()
Initialising site -------------------------------------------------------------
Creating 'docs/'
✔ Adding '^docs$' to '.Rbuildignore'
Copying '/home/nacnudus/R/x86_64-pc-linux-gnu-library/3.4/pkgdown/assets/jquery.sticky-kit.min.js'
Copying '/home/nacnudus/R/x86_64-pc-linux-gnu-library/3.4/pkgdown/assets/link.svg'
Copying '/home/nacnudus/R/x86_64-pc-linux-gnu-library/3.4/pkgdown/assets/pkgdown.css'
Copying '/home/nacnudus/R/x86_64-pc-linux-gnu-library/3.4/pkgdown/assets/pkgdown.js'
Building home -----------------------------------------------------------------
Writing '/home/nacnudus/R/temp/docs/authors.html'
Writing '/home/nacnudus/R/temp/docs/index.html'
Building function reference ---------------------------------------------------
Creating 'docs/reference/'
Loading temp
Writing '/home/nacnudus/R/temp/docs/reference/index.html'
Building news -----------------------------------------------------------------
Creating 'docs/news/'
pandoc: +smart: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1

For the time being, I'm simply using the version of pandoc bundled with RStudio. Set PATH in ~/.Renviron and add /Applications/RStudio.app/Contents/MacOS/pandoc.

For the time being, I'm simply using the version of pandoc bundled with RStudio. Set PATH in ~/.Renviron and add /Applications/RStudio.app/Contents/MacOS/pandoc.

Or simply do brew remove pandoc and RStudio will automatically use its own version of pandoc.

Workaround on Linux.

  1. Obtain the pandoc binaries

    1. Download the last pandoc v.1.19 amd64 .deb

    2. Extract the .deb into the current directory with ar vx pandoc-1.19.2.1-1-amd64.deb.

    3. Extract ./data.tar.gz into the current directory with tar zxpf data.tar.gz.

    4. Copy the pandoc and pandoc-citeproc binaries from ./usr/bin to somewhere else, e.g. ~/pandoc.

  2. Add the location of the pandoc binaries to the beginning of the R path in your .Rprofile with add_path("/path/to/pandoc/binaries", after = 0).
Was this page helpful?
0 / 5 - 0 ratings

Related issues

seanhardison1 picture seanhardison1  Â·  5Comments

stufield picture stufield  Â·  5Comments

privefl picture privefl  Â·  3Comments

echasnovski picture echasnovski  Â·  5Comments

dfalbel picture dfalbel  Â·  10Comments