r-lib / downlit

Syntax Highlighting and Automatic Linking
https://downlit.r-lib.org
Other
90 stars 22 forks source link

autolink does not work from some vignettes #70

Closed cderv closed 4 years ago

cderv commented 4 years ago

Reprex:

downlit::autolink("vignette('dplyr', package = 'dplyr')")
#> [1] NA

I would have expected this to work as in example

downlit::autolink("vignette('grid', package = 'grid')")
#> [1] "<a href='https://cran.rstudio.com/web/packages/grid/vignettes/grid.pdf'>vignette('grid', package = 'grid')</a>"

I think this comes from the remote metadata to be retrieved: https://github.com/r-lib/downlit/blob/39a98154563cabcaf80f69fae2578c5daa0724a7/R/article-index.R#L25-L43

Metadata are retrieved but there is no element metadata$articles. The fallback method is not used (even if it could have worked)

downlit:::remote_metadata("dplyr")
#> $pandoc
#> [1] "2.7.3"
#> 
#> $pkgdown
#> [1] "1.5.1.9000"
#> 
#> $pkgdown_sha
#> [1] "eae56f08694abebf93cdfc0dd8e9ede06d8c815f"
#> 
#> $last_built
#> [1] "2020-08-12T15:33Z"
#> 
#> $urls
#> $urls$reference
#> [1] "https://dplyr.tidyverse.org/reference"
#> 
#> $urls$article
#> [1] "https://dplyr.tidyverse.org/articles"
Session info ``` r sessioninfo::session_info() #> - Session info --------------------------------------------------------------- #> setting value #> version R version 4.0.2 (2020-06-22) #> os Windows 10 x64 #> system x86_64, mingw32 #> ui RTerm #> language (EN) #> collate French_France.1252 #> ctype French_France.1252 #> tz Europe/Paris #> date 2020-11-04 #> #> - Packages ------------------------------------------------------------------- #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 4.0.2) #> backports 1.2.0 2020-11-02 [1] CRAN (R 4.0.2) #> cli 2.1.0 2020-10-12 [1] CRAN (R 4.0.3) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 4.0.2) #> digest 0.6.27 2020-10-24 [1] CRAN (R 4.0.3) #> downlit 0.2.0.9000 2020-10-29 [1] github (r-lib/downlit@d0f5d32) #> ellipsis 0.3.1 2020-05-15 [1] CRAN (R 4.0.2) #> evaluate 0.14 2019-05-28 [1] CRAN (R 4.0.2) #> fansi 0.4.1 2020-01-08 [1] CRAN (R 4.0.2) #> fs 1.5.0 2020-07-31 [1] CRAN (R 4.0.2) #> glue 1.4.2 2020-08-27 [1] CRAN (R 4.0.2) #> highr 0.8 2019-03-20 [1] CRAN (R 4.0.2) #> htmltools 0.5.0 2020-06-16 [1] CRAN (R 4.0.2) #> knitr 1.30 2020-09-22 [1] CRAN (R 4.0.2) #> lifecycle 0.2.0 2020-03-06 [1] CRAN (R 4.0.2) #> magrittr 1.5 2014-11-22 [1] CRAN (R 4.0.2) #> pillar 1.4.6 2020-07-10 [1] CRAN (R 4.0.2) #> pkgconfig 2.0.3 2019-09-22 [1] CRAN (R 4.0.2) #> purrr 0.3.4 2020-04-17 [1] CRAN (R 4.0.2) #> reprex 0.3.0.9001 2020-10-21 [1] Github (tidyverse/reprex@d3fc4b8) #> rlang 0.4.8 2020-10-08 [1] CRAN (R 4.0.3) #> rmarkdown 2.5.2 2020-11-04 [1] local #> rstudioapi 0.11 2020-02-07 [1] CRAN (R 4.0.2) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 4.0.2) #> stringi 1.5.3 2020-09-09 [1] CRAN (R 4.0.2) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 4.0.2) #> styler 1.3.2 2020-02-23 [1] CRAN (R 4.0.2) #> tibble 3.0.4 2020-10-12 [1] CRAN (R 4.0.3) #> vctrs 0.3.4 2020-08-29 [1] RSPM (R 4.0.2) #> withr 2.3.0 2020-09-22 [1] CRAN (R 4.0.2) #> xfun 0.19 2020-10-30 [1] RSPM (R 4.0.3) #> yaml 2.2.1 2020-02-01 [1] CRAN (R 4.0.2) #> #> [1] C:/Users/chris/Documents/R/win-library/4.0 #> [2] C:/Program Files/R/R-4.0.2/library ```
hadley commented 4 years ago

I just did a quick fix for this (with no test), because it should largely be a transitional problem, because there was only a brief moment where pkgdown produced the malformed metadata (but unfortunately it was when the main dplyr site was built).

cderv commented 4 years ago

Oh I see. I had chosen the wrong example for my test then 😄 !