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