Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Drop fansi and import cli #1589

Merged
merged 3 commits into from
Jul 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ BugReports: https://github.com/tidyverse/tibble/issues
Depends:
R (>= 3.4.0)
Imports:
fansi (>= 0.4.0),
cli,
lifecycle (>= 1.0.0),
magrittr,
methods,
Expand All @@ -45,7 +45,6 @@ Suggests:
blob,
brio,
callr,
cli,
DiagrammeR,
dplyr,
evaluate,
Expand Down
11 changes: 2 additions & 9 deletions R/fansi.R → R/ansi.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# nocov start - https://github.com/tidyverse/tibble/blob/main/R/fansi.R
# nocov start - https://github.com/tidyverse/tibble/blob/main/R/ansi.R
set_fansi_hooks <- function() {
knitr::opts_chunk$set(collapse = TRUE)

Expand All @@ -23,13 +23,6 @@ set_fansi_hooks <- function() {
}

colourise_chunk <- function(type) {
# Fallback if fansi is missing
if (is_installed("fansi")) {
sgr_to_html <- fansi::sgr_to_html
} else {
sgr_to_html <- identity
}

function(x, options) {
# lines <- strsplit(x, "\\n")[[1]]
lines <- x
Expand All @@ -39,7 +32,7 @@ colourise_chunk <- function(type) {
paste0(
'<div class="sourceCode"><pre class="sourceCode"><code class="sourceCode">',
paste0(
sgr_to_html(htmltools::htmlEscape(lines)),
cli::ansi_html(htmltools::htmlEscape(lines)),
collapse = "\n"
),
"</code></pre></div>"
Expand Down
Loading