Added save_kable
diff --git a/NAMESPACE b/NAMESPACE
index 795899e..6cd2fd0 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -23,6 +23,7 @@
 export(magic_mirror)
 export(rmd_format)
 export(row_spec)
+export(save_kable)
 export(scroll_box)
 export(spec_angle)
 export(spec_color)
@@ -45,6 +46,7 @@
 importFrom(rmarkdown,html_dependency_jquery)
 importFrom(rmarkdown,latex_dependency)
 importFrom(rmarkdown,metadata)
+importFrom(rmarkdown,pandoc_self_contained_html)
 importFrom(rstudioapi,isAvailable)
 importFrom(rstudioapi,viewer)
 importFrom(rvest,html_table)
diff --git a/R/kableExtra-package.R b/R/kableExtra-package.R
index 7b4b72b..beeaecc 100644
--- a/R/kableExtra-package.R
+++ b/R/kableExtra-package.R
@@ -63,7 +63,7 @@
 #' @importFrom rvest html_table
 #' @importFrom knitr knit_meta_add include_graphics knit_print asis_output kable
 #' @importFrom rmarkdown latex_dependency html_dependency_bootstrap
-#' html_dependency_jquery
+#' html_dependency_jquery pandoc_self_contained_html
 #' @importFrom magrittr %>%
 #' @importFrom utils read.csv head
 #' @importFrom readr read_lines read_file
diff --git a/R/save_kable.R b/R/save_kable.R
new file mode 100644
index 0000000..078842f
--- /dev/null
+++ b/R/save_kable.R
@@ -0,0 +1,24 @@
+#' Save kable to files
+#'
+#' @param x A piece of HTML code for tables, usually generated by kable and
+#' kableExtra
+#' @param file save to files
+#' @param bs_theme Which Bootstrap theme to use
+#' @param self_contained Will the files be self-contained?
+#'
+#' @export
+save_kable <- function(x, file,
+                       bs_theme = "simplex", self_contained = TRUE) {
+  html_header <- htmltools::tags$head(
+    rmarkdown::html_dependency_jquery(),
+    rmarkdown::html_dependency_bootstrap(theme = bs_theme),
+    html_dependency_kePrint()
+  )
+  html_table <- htmltools::HTML(as.character(x))
+  html_result <- htmltools::tagList(html_header, html_table)
+  htmltools::save_html(html_result, file = file)
+  if (self_contained) {
+    rmarkdown::pandoc_self_contained_html(file, file)
+    unlink("lib", recursive = TRUE)
+  }
+}
diff --git a/man/save_kable.Rd b/man/save_kable.Rd
new file mode 100644
index 0000000..e5bad7b
--- /dev/null
+++ b/man/save_kable.Rd
@@ -0,0 +1,21 @@
+% Generated by roxygen2: do not edit by hand
+% Please edit documentation in R/save_kable.R
+\name{save_kable}
+\alias{save_kable}
+\title{Save kable to files}
+\usage{
+save_kable(x, file, bs_theme = "simplex", self_contained = TRUE)
+}
+\arguments{
+\item{x}{A piece of HTML code for tables, usually generated by kable and
+kableExtra}
+
+\item{file}{save to files}
+
+\item{bs_theme}{Which Bootstrap theme to use}
+
+\item{self_contained}{Will the files be self-contained?}
+}
+\description{
+Save kable to files
+}