-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb03657
commit ad71598
Showing
4 changed files
with
68 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
style_grid <- function(x, | ||
i = NULL, | ||
j = NULL, | ||
bold = FALSE, | ||
italic = FALSE, | ||
monospace = FALSE, | ||
underline = FALSE, | ||
strikeout = FALSE, | ||
...) { | ||
|
||
if (meta(x, "output") != "markdown") return(x) | ||
|
||
out <- x | ||
|
||
ival <- if (is.null(i)) seq_len(meta(x, "nrows")) else i | ||
jval <- if (is.null(j)) seq_len(meta(x, "ncols")) else j | ||
|
||
for (col in seq_along(out)) { | ||
out[[col]] <- as.character(out[[col]]) | ||
} | ||
|
||
for (row in ival) { | ||
for (col in jval) { | ||
if (isTRUE(bold)) { | ||
out[row, col] <- sprintf("**%s**", out[row, col]) | ||
} | ||
if (isTRUE(italic)) { | ||
out[row, col] <- sprintf("*%s*", out[row, col]) | ||
} | ||
if (isTRUE(strikeout)) { | ||
out[row, col] <- sprintf("~~%s~~", out[row, col]) | ||
} | ||
} | ||
} | ||
|
||
attr(out, "tinytable_meta") <- meta(x) | ||
class(out) <- class(x) | ||
return(out) | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.