Skip to content

Code blocks with no language specified have class="NA" in generated HTML #1251

@wch

Description

@wch

For example:

#' ```
#' r <- reactive({ compute(bigdata()) } %>%
#'   bindCache({ extract_most_recent_time(bigdata()) })
#' ```

https://github.com/rstudio/shiny/blob/6f46b847e2efb74a0cb82edee4d1c60658d8c9e1/R/bind-cache.R#L60-L63

turns into:

\if{html}{\out{<div class="sourceCode NA">}}\preformatted{r <- reactive(\{ compute(bigdata()) \} \%>\%
  bindCache(\{ extract_most_recent_time(bigdata()) \})
}\if{html}{\out{</div>}}

https://github.com/rstudio/shiny/blob/6f46b847e2efb74a0cb82edee4d1c60658d8c9e1/man/bindCache.Rd#L66-L68

(Note that in the linked code above, it was generated with roxygen2 7.1.1 and does not have the sourceCode class, but the NA issue is still present.)

If ```R is used to open the code block, then it (correctly) turns into class="sourceCode R".

Update: Are curly braces (like ```{r, eval=FALSE}) needed for syntax highlighting?

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugan unexpected problem or unintended behaviormarkdown ⬇️

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions