Skip to content

Replace .gif in README with equivalent code#3021

Open
MichaelChirico wants to merge 12 commits intomainfrom
readme-static-gif
Open

Replace .gif in README with equivalent code#3021
MichaelChirico wants to merge 12 commits intomainfrom
readme-static-gif

Conversation

@MichaelChirico
Copy link
Copy Markdown
Collaborator

Closes #2725. Because CRAN ships with one static .md file (that is not re-generated), the ~best solution I found would have involved a new step in the release process for generating the static file to ship.

Not worth it IMO when the proposal here works just as well. This also has the advantage of keeping the output correct to the day it's rendered.

@MichaelChirico MichaelChirico changed the title Replace .gif in README with equivalent cod Replace .gif in README with equivalent code Mar 8, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.23%. Comparing base (bd016a0) to head (b95a1ce).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3021   +/-   ##
=======================================
  Coverage   99.23%   99.23%           
=======================================
  Files         128      128           
  Lines        7317     7317           
=======================================
  Hits         7261     7261           
  Misses         56       56           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Copy Markdown
Collaborator

@Bisaloo Bisaloo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, we could probably also go this way:

  • save the content to lint to a tempfile
  • include the content to lint in the README with the embed knitr engine:
    ```{embed, file=pathtofile}
    ```
    
  • lint the file

This would ensure the displayed code and the linted code never go out of sync.

But it might be overengineering a little bit.

@MichaelChirico
Copy link
Copy Markdown
Collaborator Author

We do have https://github.com/r-lib/lintr/blob/bd016a02869dcec525d516bd63654f5b14cd4b01/inst/example/bad.R... my immediate worry is having the embed path work on both the website and the installed package (since inst/ will get stripped?)

But I think we can use knit_code$get() to help here?

@Bisaloo
Copy link
Copy Markdown
Collaborator

Bisaloo commented Mar 14, 2026

It's usually fair to assume the package has been installed beforehand when you render the README. devtools::render_readme() for example will install the package dev version first and then render the README. So you could use system.file(package = "lintr").

But I also think we can always use the inst/ path, since CRAN, etc. only use the rendered version README.md. The README.Rmd version is only used by us. pkgdown docs also state (I think it used to be different):

If you use index.Rmd or README.Rmd it's your responsibility to knit the document to create the corresponding .md. pkgdown does not do this for you because it only touches files in the doc/ directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ship a static .gif file with the CRAN README

2 participants