I'm wondering if it's possible to insert newlines inside code blocks in roxygen2 when documenting a function?
If I have something inside \code{}
, roxygen2 collapses all newlines into single spaces by default. I tried inserting \cr
inside to enforce a line break, and I get the desired behaviour, but then I get a WARNING when I "R CMD CHECK". Is there a way to do this?
Example:
#' \code{
#' multiple
#' lines
#' }
Use \preformatted
instead of \code
. \code
is for inline code (works like ``
on SO) and \preformatted
is for verbatim blocks (like indentation on SO).
#' \preformatted{
#' multiple
#' lines
#' }
Note that the initial line break, just after {
, will also be part of the code block, so you might want to consider removing it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With