pkgdown and \dontshow

I just created a website for my recently-published R-package with pkgdown, and I'm really amazed about how nicely this works. There's one issue, however, I could not solve whatever I tried, and whereever I searched:
In some of my functions' roxygen2 documentation, I have a few lines of example code wrapped in \dontshow{}. When I build the usual documentation and check it, this code is not displayed - exactly as intended. However, when I'm using pkdown::build_site() (or pkgdown::build_reference()), the examples displayed in the functions' html-reference do show the whole \dontshow construction, including the wrapped code.

In order to reproduce this behaviour independently from my original package, I built a minimalistic package around this function:

#' myfunction
#' @return This function returns 5
#' @export
#' @examples
#' b <- myfunction()
#' \dontshow{
#'   b <- 17
#' }
myfunction <- function() {

Building the roxygen2-documentation renders the example (as intended) as

b <- myfunction()

while in the pkdown-generated reference it reads as follows, i.e. \dontshow does not have any effect:

b <- myfunction()
# \dontshow{
b <- 17
# }

Clearly, I could manually edit the html-files, but I would have to do so every time after I re-build the reference. I apologize, if I missed an obvious solution. Anyway, any hints would be greatly appreciated.


This topic was automatically closed after 45 days. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.