Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 1 | #' @export |
Hao Zhu | b9da01c | 2018-01-14 21:01:57 -0500 | [diff] [blame^] | 2 | print.kableExtra <- function(x, ...) { |
Hao Zhu | f210083 | 2018-01-11 16:20:29 -0500 | [diff] [blame] | 3 | cat(as.character(x)) |
Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 4 | html_header <- htmltools::tags$head( |
| 5 | rmarkdown::html_dependency_jquery(), |
Hao Zhu | 8a69ad1 | 2018-01-10 18:01:41 -0500 | [diff] [blame] | 6 | rmarkdown::html_dependency_bootstrap(theme = "simplex"), |
| 7 | html_dependency_kePrint() |
Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 8 | ) |
Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 9 | html_table <- htmltools::HTML(as.character(x)) |
Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 10 | htmltools::html_print(htmltools::tagList(html_header, html_table)) |
| 11 | } |
| 12 | |
Hao Zhu | 8a69ad1 | 2018-01-10 18:01:41 -0500 | [diff] [blame] | 13 | html_dependency_kePrint <- function() { |
| 14 | htmlDependency(name = "kePrint", |
| 15 | version = "0.0.1", |
Hao Zhu | 7cb0e37 | 2018-01-10 18:29:30 -0500 | [diff] [blame] | 16 | src = system.file("kePrint-0.0.1", |
Hao Zhu | 8a69ad1 | 2018-01-10 18:01:41 -0500 | [diff] [blame] | 17 | package = "kableExtra"), |
| 18 | script = "kePrint.js") |
| 19 | } |
Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 20 | |
| 21 | #' @export |
Hao Zhu | c830679 | 2018-01-11 12:34:35 -0500 | [diff] [blame] | 22 | knit_print.kableExtra <- function(x, ...) { |
Hao Zhu | eaef431 | 2018-01-10 17:05:23 -0500 | [diff] [blame] | 23 | x <- paste0(x, "\n\n") |
| 24 | asis_output(x) |
| 25 | } |
| 26 | |
| 27 | |
| 28 | |
| 29 | |