escape_examples: Escape examples

View source: R/rd-examples.R

escape_examplesR Documentation

Escape examples


This documentation topic is used primarily for testing and to record our understanding of the \example{} escaping rules. See for the details provided by R core.




# In examples we automatically escape Rd comments (%):
100 %% 30
# even if they are in strings

# and \ and \v inside of strings and symbols
"\v" # vertical tab
# but not comments: \l \v

# other string escapes are left as is

# Otherwise, backslashes and parentheses are left as is. This
# means that you need to escape unbalanced parentheses, which typically only
# occur in \dontshow{}:


# You also need to escape backslashes in infix operators and comments
# (this is generally rare)
`%\\%` <- function(x, y) x + y
10 %\% 20
# \\ (renders as two backslashes)

roxygen2 documentation built on Dec. 9, 2022, 1:09 a.m.