etiennebacher / altdoc

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

README fig path #184

Closed vincentarelbundock closed 11 months ago

vincentarelbundock commented 11 months ago

It is unsafe to use regexes to modify the links in the REAMDE, as demonstrated by https://github.com/etiennebacher/altdoc/issues/178

The robust way to do this is to use knitr::opts_chunk$set() to save code-generated images in the man/ directory.

Users who want to display static files in their README should also save them in the man/ directory. AFAICT, this has been the "traditional" and "correct" way to achive this for a long time on CRAN.

The downside of this approach is that it requires a bit of user-intervention (it's not hard and we can document it).

The upside is that we don't need to write dangerous/broken code in altdoc, and that images are "guaranteed" to work on CRAN, Github, and on the website.

This PR adds a README.qmd in the altdoc repo, with a new section which displays code-generated and static images. That way, the altdoc repo acts as a self-contained example of best practices.

This PR also removes the .img_readme_move() and related functions.

etiennebacher commented 11 months ago

Thanks, I couldn't review this before but it looks good. I think we could move the example from the README to a specific (small) section in the docs