etiennebacher / altdoc

Alternative to pkgdown to document R packages
https://altdoc.etiennebacher.com
Other
62 stars 9 forks source link

lifecycle badge image not found on quarto site #275

Open rbcavanaugh opened 4 months ago

rbcavanaugh commented 4 months ago

If I have the following in my function roxygen2 documentation

#' Creates a temporary table from a local data frame or tibble
#'
#' `r lifecycle::badge('experimental')`

I get the following on the generated reference page for the function:

image

(link to function: https://github.com/roux-ohdsi/allofus/blob/main/R/aou_temp_tables.R and site: https://roux-ohdsi.github.io/allofus/man/aou_create_temp_table.html)

etiennebacher commented 4 months ago

The link is behind an "html" flag in the Rd file:

https://github.com/roux-ohdsi/allofus/blob/aaf66ddf767f428b0c2b7bcaeb1bd4a753b8ef2a/man/aou_create_temp_table.Rd#L37-L39

The first step would be to check if this link appears in the markdown file produced by .rd2qmd()

etiennebacher commented 4 months ago

I see, the link correctly appears in the qmd file but it links to the badge that is located in man/figures and this badge is not imported in the docs folder.

vincentarelbundock commented 4 months ago

Can we swap the lifecycle line with some kind of conditional link? It feels silly to import another package and build complicated backend code just to insert an image and a link in the docs...

etiennebacher commented 4 months ago

IIUC we wouldn't have to import lifecycle, we would just need to copy all the SVG badges from man/figures (I guess those are created by devtools::document()) to docs/man/figures. We don't have to use any functionalities from lifecycle itself

vincentarelbundock commented 4 months ago

I was thinking there must exist a one-liner to load an image from a website without altdoc having to do anything at all.

But I've not tried to find one yet...

vincentarelbundock commented 4 months ago

If that one-line doesn't exist or is too complicated, we should support a more general interface to inserting images in documentation.

I just think we should resist the temptation to replicate every possible tidyverse functionality with dedicated arguments and backend code, and try to think of more general ways to do things.