Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What to do about \dontshow? #2188

Closed
jennybc opened this issue Sep 1, 2022 · 3 comments · Fixed by #2629
Closed

What to do about \dontshow? #2188

jennybc opened this issue Sep 1, 2022 · 3 comments · Fixed by #2629
Labels
feature a feature request or enhancement reference 📚
Milestone

Comments

@jennybc
Copy link
Member

jennybc commented Sep 1, 2022

I gather from #1540 that pkgdown's current (non) handling of \dontshow is intentional.

There's a specific use we make of \dontshow in several packages and I'm wondering if it's compelling enough to resurrect the matter. Or if it leads to some new feature idea with a narrower scope than full \dontshow support, but that still meets our needs.

Here's a search for \dontshow in tidyverse and r-lib:
https://cs.github.com/?scopeName=tidyverse+and+r-lib&scope=org%3Atidyverse+OR+org%3Ar-lib&q=dontshow+path%3AR%2F*

fs, usethis, readr, asciicast all use \dontshow to hide some yucky stuff that we need to do behind the scenes, but that add unnecessary noise to the examples when being consumed by a normal user.

Almost all of the use is to temporarily set working directory to session temp directory, demo something that writes files, then restore working directory. Lots of this:

#' \dontshow{.old_wd <- setwd(tempdir())}
#' file_create("foo")
#' link_create(path_abs("foo"), "bar")
#' link_path("bar")
#'
#' # Cleanup
#' file_delete(c("foo", "bar"))
#' \dontshow{setwd(.old_wd)}

That's from the docs for fs::link_path() and, indeed all the \dontshow commands are actually shown. Which is true for all of the hits. (BTW the \dontshow content is not showing in local help topics.)

Do we want to reconsider \dontshow or maybe address this common working directory maneuver directly (i.e. another special case similar to @examplesIf)?

@hadley
Copy link
Member

hadley commented Apr 16, 2024

I took a bit of a look at this and it's going to be a reasonable amount of work because we somehow need to wrap the dontshow tags in some custom HTML so it's still run as part of the example, but isn't shown on the final page.

@hadley
Copy link
Member

hadley commented May 9, 2024

I think we'll need to enforce the limitation that the \dontshow must be it's own complete line, since I have no idea what 1\dontshow{+}1 would be expected to display. I don't think that should be a limitation in practice.

@hadley
Copy link
Member

hadley commented Jun 4, 2024

Needs r-lib/evaluate#125

hadley added a commit that referenced this issue Jun 4, 2024
rforge pushed a commit to r-forge/surveillance that referenced this issue Sep 1, 2024
e.g., \dontshow{## IGNORE_RDIFF_BEGIN} is broken, see also
<r-lib/pkgdown#2188 (comment)>



git-svn-id: svn://svn.r-forge.r-project.org/svnroot/surveillance@3110 edb9625f-4e0d-4859-8d74-9fd3b1da38cb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature a feature request or enhancement reference 📚
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants