Use pkgdown selective HTML for dev/release docs#1060
Use pkgdown selective HTML for dev/release docs#1060seabbs-bot wants to merge 3 commits intomainfrom
Conversation
Replace R code that detects package version at knit time with pkgdown's built-in selective HTML feature. This uses .pkgdown-devel and .pkgdown-release CSS classes to show appropriate documentation links based on whether pkgdown is building the dev or release site. This approach is cleaner and more reliable as it doesn't depend on the package version installed when knitting the README. Closes #810
Instead of embedding selective HTML directly in README (which shows on GitHub), generate pkgdown/index.md at build time by prepending the version note header to README.md. This keeps README.md clean for GitHub while giving pkgdown the version-aware home page.
Use sed to insert the header content after the badges section rather than prepending it to the entire file.
247ebae to
cfc5804
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1060 +/- ##
=======================================
Coverage 97.83% 97.83%
=======================================
Files 35 35
Lines 1845 1845
=======================================
Hits 1805 1805
Misses 40 40 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
seabbs
left a comment
There was a problem hiding this comment.
This looks good and I think is correct. Calling for another review as this is just me and @seabbs-bot
nikosbosse
left a comment
There was a problem hiding this comment.
Huh, the sed injection is quite clever. Nice!
|
It does remove the reference in the Github Readme though, right? Not sure how much we mind. Maybe slightly?
|
|
Yes that was intentional. I don't think it is really clear why you would want that in the github docs? It seems like the path should be to get everyone into the html docs and then go from there. If you do think that is useful then it is quite easy to have it stay in the readme by injecting it at build time when we render the readme from Rmd to md. |
Summary
.pkgdown-develand.pkgdown-releaseCSS classes to show appropriate documentation links based on whether pkgdown is building the dev or release siteChanges
The previous approach used R code in a setup chunk to detect if the installed version was a dev version:
This has been replaced with pkgdown's selective HTML:
::: {.pkgdown-devel} ***Note***: [*This documentation*](https://epiforecasts.io/scoringutils/dev/)... ::: ::: {.pkgdown-release} ***Note***: [*This documentation*](https://epiforecasts.io/scoringutils/)... :::References
pkgdownto render dev version docs #810This was opened by a bot. Please ping @seabbs for any questions.