Apply class kableExtra to all HTML functions
diff --git a/R/add_header_above.R b/R/add_header_above.R
index 5231c7f..bf99378 100644
--- a/R/add_header_above.R
+++ b/R/add_header_above.R
@@ -68,6 +68,7 @@
xml_add_child(kable_xml_thead, new_header_row, .where = 0)
out <- as_kable_xml(kable_xml)
attributes(out) <- kable_attrs
+ if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
return(out)
}
diff --git a/R/add_indent.R b/R/add_indent.R
index a0cb37f..8dc2d4d 100644
--- a/R/add_indent.R
+++ b/R/add_indent.R
@@ -87,5 +87,6 @@
}
out <- as_kable_xml(kable_xml)
attributes(out) <- kable_attrs
+ if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
return(out)
}
diff --git a/R/collapse_rows.R b/R/collapse_rows.R
index af2c0a5..38a8216 100644
--- a/R/collapse_rows.R
+++ b/R/collapse_rows.R
@@ -66,6 +66,7 @@
out <- as_kable_xml(kable_xml)
attributes(out) <- kable_attrs
+ if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
return(out)
}
diff --git a/R/column_spec.R b/R/column_spec.R
index a640a4d..0c351a3 100644
--- a/R/column_spec.R
+++ b/R/column_spec.R
@@ -131,6 +131,7 @@
out <- as_kable_xml(kable_xml)
attributes(out) <- kable_attrs
+ if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
return(out)
}
diff --git a/R/footnote.R b/R/footnote.R
index a05360f..bb48e0d 100644
--- a/R/footnote.R
+++ b/R/footnote.R
@@ -147,6 +147,7 @@
out <- as_kable_xml(kable_xml)
attributes(out) <- kable_attrs
+ if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
return(out)
}
diff --git a/R/kable_styling.R b/R/kable_styling.R
index bbb8e07..d349120 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -169,7 +169,7 @@
out <- as_kable_xml(kable_xml)
attributes(out) <- kable_attrs
- class(out) <- c("kableExtra", class(out))
+ if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
return(out)
}
diff --git a/R/print.R b/R/print.R
index 93d0909..cf0de0a 100644
--- a/R/print.R
+++ b/R/print.R
@@ -1,13 +1,12 @@
#' @export
print.kableExtra <- function(x) {
+ cat(as.character(x))
html_header <- htmltools::tags$head(
rmarkdown::html_dependency_jquery(),
rmarkdown::html_dependency_bootstrap(theme = "simplex"),
html_dependency_kePrint()
)
-
html_table <- htmltools::HTML(as.character(x))
- cat(as.character(x))
htmltools::html_print(htmltools::tagList(html_header, html_table))
}
diff --git a/R/row_spec.R b/R/row_spec.R
index deedf68..88bf499 100644
--- a/R/row_spec.R
+++ b/R/row_spec.R
@@ -97,6 +97,7 @@
out <- as_kable_xml(kable_xml)
attributes(out) <- kable_attrs
+ if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
return(out)
}
diff --git a/R/scroll_box.R b/R/scroll_box.R
index 9cf85d3..44bd096 100644
--- a/R/scroll_box.R
+++ b/R/scroll_box.R
@@ -29,5 +29,6 @@
out <- structure(out, format = "html",
class = "knitr_kable")
attributes(out) <- kable_attrs
+ if (!"kableExtra" %in% class(out)) class(out) <- c("kableExtra", class(out))
return(out)
}