tests/testthat/_snaps/markdown-code.md

multi-line inline code gives useful warning

Code
  out <- roc_proc_text(rd_roclet(), block)[[1]]
Message
  x <text>:4: @description failed to evaluate inline markdown code.
  Caused by error:
  ! Multi-line `r ` markup is not supported.

inline code gives useful warning

Code
  out <- roc_proc_text(rd_roclet(), block)[[1]]
Output

Message

  Quitting from :1-1
  x <text>:4: @description failed to evaluate inline markdown code.
  Caused by error:
  ! Failed to parse the inline R code: `r 1 + `
  Reason: <text>:2:0: unexpected end of input
  1: 1 + 
     ^

interleaving fences and inline code

Code
  cat(out1$get_value("details"))
Output
  Details 10

  \if{html}{\out{<div class="sourceCode r">}}\preformatted{y <- x + 10
  y
  #> [1] 20
  }\if{html}{\out{</div>}}

preserves white space

Code
  cat(out1$get_value("details"))
Output
  \if{html}{\out{<div class="sourceCode r">}}\preformatted{a <- 1

  b <- 2
  }\if{html}{\out{</div>}}

  \if{html}{\out{<div class="sourceCode r">}}\preformatted{c <- 3
  }\if{html}{\out{</div>}}

alternative knitr engines

Code
  print(out1 <- roc_proc_text(rd_roclet(),
  "\n      #' Title\n      #'\n      #' Description.\n      #'\n      #' ```{verbatim}\n      #' #| file = testthat::test_path(\"example.Rmd\")\n      #' ```\n      #' @md\n      #' @name x\n      NULL\n    "))
Output
  $x.Rd
  % Generated by roxygen2: do not edit by hand
  % Please edit documentation in ./<text>
  \name{x}
  \alias{x}
  \title{Title}
  \description{
  Description.
  }
  \details{
  \if{html}{\out{<div class="sourceCode default">}}\preformatted{```\{r\}
  # comment
  this <- 10
  is <- this + 10
  good <- this + is
  }\if{html}{\out{</div>}}
  }


Try the roxygen2 package in your browser

Any scripts or data that you put into this service are public.

roxygen2 documentation built on Aug. 5, 2026, 1:06 a.m.