Skip to content

Commit

Permalink
also support the attributes from record_print.xfun_raw_string() in fo…
Browse files Browse the repository at this point in the history
…rmat.xfun_record_results()
  • Loading branch information
yihui committed Jan 10, 2025
1 parent 233d8f0 commit ca921b4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: xfun
Type: Package
Title: Supporting Functions for Packages Maintained by 'Yihui Xie'
Version: 0.50.2
Version: 0.50.3
Authors@R: c(
person("Yihui", "Xie", role = c("aut", "cre", "cph"), email = "[email protected]", comment = c(ORCID = "0000-0003-0645-5666", URL = "https://yihui.org")),
person("Wush", "Wu", role = "ctb"),
Expand Down
5 changes: 3 additions & 2 deletions R/record.R
Original file line number Diff line number Diff line change
Expand Up @@ -375,14 +375,15 @@ format.xfun_record_results = function(
if (is_md && cls == 'plot') {
z = sprintf('![%s](<%s>)', alt, z)
} else {
o = attr(z, 'opts')
z = gsub('^(\\s*\n)+|\n\\s*$', '', one_string(z)) # trim blank lines
if (cls != 'source') z = paste('#>', split_lines(z))
if (cls != 'source') z = paste0(o$comment %||% '#> ', split_lines(z))
if (is_md) {
cls_all = if (any(c('message', 'warning', 'error') %in% cls_all)) {
c('plain', cls_all)
} else if (cls == 'source') {
replace(cls_all, cls_all == 'source', 'r')
} else setdiff(cls_all, 'output')
} else setdiff(c(o$attr, cls_all), 'output')
z = fenced_block(z, sprintf('.%s', cls_all))
}
}
Expand Down

0 comments on commit ca921b4

Please sign in to comment.