Skip to content

Conversation

@gadenbuie
Copy link
Member

@gadenbuie gadenbuie commented Mar 28, 2023

Updates the examples for navs_tab(), navs_pill(), etc. to include complete and (nearly) selc-contained examples that are more friendly for copy-pasting.

I tried unsuccessfully to come up with a solution that uses the @examples section combined with a custom pkgdown_print method. Unfortunately there are a few too many moving pieces for that approach to work right now.

The approach in this PR is to use an Rmd fragment (aka child document in a roxygen2 context) that renders the examples, takes a screenshot, and then replaces the output with the screenshot. The previews are static as a result, but they also appear in both the pkgdown site and the R package docs, which is overall an improvement in my opinion.

By default the screenshot previews are re-generated when calling devtools::document() on CI so they will automatically stay up to date with our routine workflows. I've also modified bslib's routine.sh to run optipng on png files in man/figures to keep the images small. In the end, they're each about 10 KB or less.

schloerke added a commit to rstudio/shiny-workflows that referenced this pull request Mar 29, 2023
Originally from rstudio/bslib#521

Co-Authored-By: Garrick Aden-Buie <garrick@adenbuie.com>
@gadenbuie
Copy link
Member Author

(The last commit was to make sure we're not going to get frequent routine bot commits with updated screenshots. And it looks like we're okay.)

@gadenbuie gadenbuie merged commit 246f5b3 into main Apr 12, 2023
@gadenbuie gadenbuie deleted the navs-tab-examples branch April 12, 2023 19:19
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.

4 participants