diff --git a/R/markdown.R b/R/markdown.R index 39bce8e24..7685da533 100644 --- a/R/markdown.R +++ b/R/markdown.R @@ -172,7 +172,7 @@ markdown_tags <- list( }, code = function(xml) { - list("\\code{", gsub("%", "\\\\%", xml_contents(xml)), "}") + list("\\code{", gsub("%", "\\\\%", xml_text(xml)), "}") }, html_inline = function(xml) { diff --git a/tests/testthat/test-rd-markdown.R b/tests/testthat/test-rd-markdown.R index d590858bc..e2d93612c 100644 --- a/tests/testthat/test-rd-markdown.R +++ b/tests/testthat/test-rd-markdown.R @@ -68,6 +68,16 @@ test_that("inline code escapes %", { expect_equal(out$get_field("title")$values, "\\code{0.5\\%}") }) +test_that("inline code works with < and >", { + out <- roc_proc_text(rd_roclet(), " + #' `SELECT FROM ` + #' @md + f <- function() 1 + ")[[1]] + + expect_equal(out$get_field("title")$values, "\\code{SELECT FROM
}") +}) + test_that("itemized lists work", { out1 <- roc_proc_text(roc, " #' Title