Pkgdown: Vignette sections with NOT_CRAN are not evaluating in v1.5.0

Created on 28 Mar 2020  路  10Comments  路  Source: r-lib/pkgdown

Hello, I have two vignettes for an API wrapper package that use NOT_CRAN extensively for documentation. I've used the convention established in packages like googlesheets to have examples render to markdown but not run in CRAN checks.
NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true")

The vignettes are here: https://github.com/hrecht/censusapi/tree/master/vignettes

After updating to pkgdown 1.5.0 those sections are no longer displaying the code results when knit by pkgdown. When I use the knit button in RStudio they do evaluate properly. The code should get some data via API and then display the first rows using head(). I receive no error messages, but no data is shown in the resulting article pages. All of the text and code compile properly, it's just the code evaluation results that seem to be an issue.

I made one of the two vignettes online-only and removed any NOT_CRAN mentions and that seemed to fix the pkgdown compiling issue for that article. I've troubleshooted but am not totally sure what the issue is in my code. Are there some changes that need to be made in RMarkdown to make code run in pkgdown but not CRAN in the new version?

Thanks for such a great package!

reprex

Most helpful comment

First of all, congratulations on having developed such a wonderful package!
I have experienced similar behavior after updating to v1.5.0. It seems that all code inserted after <- is not rendered.
Take a look at my vignette vignettes_blup.Rmd and at the results generated by pkgdown

As far as I can see all my articles have this same behavior.
Best regards

All 10 comments

I can't reproduce this, but I feel like I'm missing something about the (un)expected behavior..

Here's the output of this test vignette with dev pkgdown:

```` markdown

title: "NOT_CRAN"

```{r, include = FALSE}
library(withr)
withr::with_envvar(
c("NOT_CRAN" = TRUE),
NOT_CRAN <- identical(tolower(Sys.getenv("NOT_CRAN")), "true")
)

knitr::opts_chunk$set(
purl = NOT_CRAN,
collapse = TRUE,
comment = "#>"
)

```{r setup}
library(pkgdown)

{r purl = NOT_CRAN, eval = NOT_CRAN, echo = NOT_CRAN} cat("should be run")

````

First of all, congratulations on having developed such a wonderful package!
I have experienced similar behavior after updating to v1.5.0. It seems that all code inserted after <- is not rendered.
Take a look at my vignette vignettes_blup.Rmd and at the results generated by pkgdown

As far as I can see all my articles have this same behavior.
Best regards

Thanks @jayhesselberth for working on this. Here's the output of one of my articles with the issue at hand. https://hrecht.github.io/censusapi/articles/getting-started.html
https://github.com/hrecht/censusapi/blob/master/vignettes/getting-started.Rmd#L91

From line 91 down nearly all the code chunks use NOT_CRAN. They show no output. The sections without NOT_CRAN (not requiring code using an API key) are working as expected.

@jayhesselberth : just to mention that I am seeing the same behaviour reported by @TiagoOlivoto regarding not rendering of content inserted after <- assignments. It seems the real culprit may be <-, then , and not NOT_CRAN

Could someone please explain the exact problem with a small reprex? I don't know what your vignettes are supposed to look like, so its hard for me to understand what precisely the problem is.

@hadley Sure. Here is a "test" repo:

https://github.com/lbusett/testpkgdown

, with corresponding pkgdown website at:

https://lbusett.github.io/testpkgdown/

You can see that lines with "<-" assignment are not rendered properly in the pkgdown website, while they are ok in the GitHun rendered Readme.

HTH!

@lbusett I can't reproduce that issue, here's what I see.

Can you please report the output of:

rmarkdown::pandoc_version()

and

devtools::session_info()

@jayhesselberth

Sure. Here it is:

library(pkgdown)

rmarkdown::pandoc_version()
#> [1] '2.7.3'

devtools::session_info()
#> - Session info ---------------------------------------------------------------
#>  setting  value                       
#>  version  R version 3.6.1 (2019-07-05)
#>  os       Windows 10 x64              
#>  system   x86_64, mingw32             
#>  ui       RTerm                       
#>  language (EN)                        
#>  collate  English_United Kingdom.1252 
#>  ctype    English_United Kingdom.1252 
#>  tz       Europe/Paris                
#>  date     2020-03-30                  
#> 
#> - Packages -------------------------------------------------------------------
#>  package     * version  date       lib source        
#>  assertthat    0.2.1    2019-03-21 [1] CRAN (R 3.6.1)
#>  backports     1.1.5    2019-10-02 [1] CRAN (R 3.6.1)
#>  callr         3.4.2    2020-02-12 [1] CRAN (R 3.6.2)
#>  cli           2.0.2    2020-02-28 [1] CRAN (R 3.6.3)
#>  crayon        1.3.4    2017-09-16 [1] CRAN (R 3.6.1)
#>  desc          1.2.0    2018-05-01 [1] CRAN (R 3.6.1)
#>  devtools      2.2.2    2020-02-17 [1] CRAN (R 3.6.2)
#>  digest        0.6.25   2020-02-23 [1] CRAN (R 3.6.3)
#>  ellipsis      0.3.0    2019-09-20 [1] CRAN (R 3.6.1)
#>  evaluate      0.14     2019-05-28 [1] CRAN (R 3.6.1)
#>  fansi         0.4.1    2020-01-08 [1] CRAN (R 3.6.2)
#>  fs            1.3.2    2020-03-05 [1] CRAN (R 3.6.3)
#>  glue          1.3.2    2020-03-12 [1] CRAN (R 3.6.3)
#>  highr         0.8      2019-03-20 [1] CRAN (R 3.6.1)
#>  htmltools     0.4.0    2019-10-04 [1] CRAN (R 3.6.1)
#>  knitr         1.28     2020-02-06 [1] CRAN (R 3.6.2)
#>  magrittr      1.5      2014-11-22 [1] CRAN (R 3.6.1)
#>  MASS          7.3-51.5 2019-12-20 [1] CRAN (R 3.6.2)
#>  memoise       1.1.0    2017-04-21 [1] CRAN (R 3.6.1)
#>  pkgbuild      1.0.6    2019-10-09 [1] CRAN (R 3.6.1)
#>  pkgdown     * 1.5.0    2020-03-25 [1] CRAN (R 3.6.1)
#>  pkgload       1.0.2    2018-10-29 [1] CRAN (R 3.6.1)
#>  prettyunits   1.1.1    2020-01-24 [1] CRAN (R 3.6.2)
#>  processx      3.4.2    2020-02-09 [1] CRAN (R 3.6.2)
#>  ps            1.3.2    2020-02-13 [1] CRAN (R 3.6.2)
#>  R6            2.4.1    2019-11-12 [1] CRAN (R 3.6.1)
#>  Rcpp          1.0.4    2020-03-17 [1] CRAN (R 3.6.3)
#>  remotes       2.1.1    2020-02-15 [1] CRAN (R 3.6.2)
#>  rlang         0.4.5    2020-03-01 [1] CRAN (R 3.6.3)
#>  rmarkdown     2.1      2020-01-20 [1] CRAN (R 3.6.3)
#>  rprojroot     1.3-2    2018-01-03 [1] CRAN (R 3.6.1)
#>  sessioninfo   1.1.1    2018-11-05 [1] CRAN (R 3.6.1)
#>  stringi       1.4.6    2020-02-17 [1] CRAN (R 3.6.2)
#>  stringr       1.4.0    2019-02-10 [1] CRAN (R 3.6.1)
#>  testthat      2.3.2    2020-03-02 [1] CRAN (R 3.6.3)
#>  usethis       1.5.1    2019-07-04 [1] CRAN (R 3.6.1)
#>  withr         2.1.2    2018-03-15 [1] CRAN (R 3.6.1)
#>  xfun          0.12     2020-01-13 [1] CRAN (R 3.6.2)
#>  yaml          2.2.1    2020-02-01 [1] CRAN (R 3.6.2)
#> 
#> [1] D:/Documents/R/win-library/3.6
#> [2] C:/Program Files/R/R-3.6.1/library

Created on 2020-03-30 by the reprex package (v0.3.0)

Closing in favour of #1282

Was this page helpful?
0 / 5 - 0 ratings