diff --git a/R/output.R b/R/output.R index 3ddbfa30ae..f65231ffd1 100644 --- a/R/output.R +++ b/R/output.R @@ -563,7 +563,9 @@ knit_cnd_format = function(cnd) { #' @export knit_cnd_format.message = function(cnd) { - conditionMessage(cnd) + # Character vectors are created by `merge_class()` to support + # https://github.com/yihui/knitr-examples/blob/master/117-messages.Rmd + paste(conditionMessage(cnd), collapse = '') } #' @export diff --git a/tests/testit/test-output.R b/tests/testit/test-output.R index 0de1122c3b..9f5f8e492f 100644 --- a/tests/testit/test-output.R +++ b/tests/testit/test-output.R @@ -192,3 +192,12 @@ local({ ) }) }) + +# Character vectors are created by `merge_class()` to support +# https://github.com/yihui/knitr-examples/blob/master/117-messages.Rmd +assert('knit_cnd_format.message() supports character vectors', + identical( + knit_cnd_format(simpleMessage(c("foo", "bar"))), + "foobar" + ) +)