Skip to content

Commit

Permalink
fix: replace knitr:::escape_html by xfun::html_escape (#1284)
Browse files Browse the repository at this point in the history
  • Loading branch information
eitsupi authored Nov 13, 2024
1 parent a3d3d0c commit 1e1910d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ Suggests:
tibble,
tools,
vctrs,
withr
withr,
xfun (>= 0.48)
Config/Needs/website:
altdoc,
future.apply,
Expand Down
8 changes: 7 additions & 1 deletion R/pkg-knitr.R
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,13 @@ to_html_table = function(x, max_cols = 75, max_rows = 40) {
stop("Please install the `knitr` package to use `to_html_table`.")
}

escape_html = getFromNamespace("escape_html", "knitr")
# escape_html will be removed from knitr (> 1.49)
if (exists("html_escape", where = asNamespace("xfun"), mode = "function")) {
escape_html = xfun::html_escape
} else {
escape_html = getFromNamespace("escape_html", "knitr")
}

omit_chr = "…"

.dim = dim(x)
Expand Down

0 comments on commit 1e1910d

Please sign in to comment.