From 122000cc149e33e3869da56c569c5b0b39173ccb Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Fri, 17 Apr 2026 14:57:20 +0200 Subject: [PATCH 1/2] Drop warning for `` `R ` `` usage Since it's common to write (e.g.) `` `R CMD check` `` --- NEWS.md | 1 - R/markdown.R | 4 ---- tests/testthat/_snaps/markdown-code.md | 2 +- tests/testthat/test-markdown-code.R | 9 --------- 4 files changed, 1 insertion(+), 15 deletions(-) diff --git a/NEWS.md b/NEWS.md index ddb536efa..419dd193f 100644 --- a/NEWS.md +++ b/NEWS.md @@ -11,7 +11,6 @@ * `` `Rd expr` `` inline code now generates `\Sexpr[stage=render,results=rd]{expr}`, providing a convenient syntax for evaluating R code at documentation render time (#1214). * Indented bullet lists in `@param` and other two-part tags are no longer incorrectly nested (#1102). * Horizontal rules (e.g. `----`) now generate a clear warning instead of an internal error about an unknown `thematic_break` xml node (#1707). -* Inline code with uppercase `` `R ` `` now warns that you should use lowercase `` `r ` `` instead, since knitr only supports lowercase. * Inline R code (`` `r expr` ``) in non-indented list continuation lines no longer causes an error (#1651). * Link text now supports non-code markup like bold and italic, e.g., `[*italic text*][func]` generates `\link[=func]{\emph{italic text}}`, matching R's support for markup in `\link` text in R 4.5.0. * Links now do a better job of resolving package names: the process is cached for better performance (#1724); it works with infix operators (e.g. `[%in%]`) (#1728); no longer changes the link text (#1662); and includes base packages when reporting ambiguous functions (#1725). Links to external packages now use the topic alias instead of the Rd file name as the anchor. This fixes "Non-topic package-anchored link(s)" notes from R CMD check (#1709). diff --git a/R/markdown.R b/R/markdown.R index cf4e6d297..508f2cc2a 100644 --- a/R/markdown.R +++ b/R/markdown.R @@ -335,10 +335,6 @@ mdxml_break <- function(state) { mdxml_code <- function(xml, tag) { code <- xml_text(xml) - if (grepl("^R ", code)) { - warn_roxy_tag(tag$tag, "use ` r`, not `R `, for inline code") - } - if (grepl("^Rd ", code)) { paste0( "\\Sexpr[stage=render,results=rd]{", diff --git a/tests/testthat/_snaps/markdown-code.md b/tests/testthat/_snaps/markdown-code.md index f37a8b6a8..7fbd96d57 100644 --- a/tests/testthat/_snaps/markdown-code.md +++ b/tests/testthat/_snaps/markdown-code.md @@ -3,7 +3,7 @@ Code . <- roc_proc_text(rd_roclet(), text) Message - x :2: @title use ` r`, not `R `, for inline code. + x :2: @title use `r `, not `R `, for inline code. # multi-line inline code gives useful warning diff --git a/tests/testthat/test-markdown-code.R b/tests/testthat/test-markdown-code.R index 332a3ef58..b5772bc94 100644 --- a/tests/testthat/test-markdown-code.R +++ b/tests/testthat/test-markdown-code.R @@ -30,15 +30,6 @@ test_that("can eval inline code", { expect_equal(out1$get_value("description"), "Description 4") }) -test_that("uppercase R in inline code gives warning", { - text <- " - #' @title Title `R 1 + 1` - #' @md - foo <- function() NULL - " - expect_snapshot(. <- roc_proc_text(rd_roclet(), text)) -}) - test_that("can eval fenced code", { out1 <- roc_proc_text( rd_roclet(), From f5a3d850c6e0fa490877363f9d91414414a9bdf9 Mon Sep 17 00:00:00 2001 From: Hadley Wickham Date: Fri, 17 Apr 2026 15:27:26 +0200 Subject: [PATCH 2/2] Update snapshot --- tests/testthat/_snaps/markdown-code.md | 7 ------- 1 file changed, 7 deletions(-) diff --git a/tests/testthat/_snaps/markdown-code.md b/tests/testthat/_snaps/markdown-code.md index 7fbd96d57..6d6509aee 100644 --- a/tests/testthat/_snaps/markdown-code.md +++ b/tests/testthat/_snaps/markdown-code.md @@ -1,10 +1,3 @@ -# uppercase R in inline code gives warning - - Code - . <- roc_proc_text(rd_roclet(), text) - Message - x :2: @title use `r `, not `R `, for inline code. - # multi-line inline code gives useful warning Code