Merge pull request #197 from leovan/master

Allow no colnames with PDF output when booktabs enabled
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/column_spec.R b/R/column_spec.R
index 1a07910..2e78586 100644
--- a/R/column_spec.R
+++ b/R/column_spec.R
@@ -148,6 +148,9 @@
                                   border_left, border_right,
                                   border_l_css, border_r_css,
                                   extra_css) {
+  if (is.na(xml_attr(target_cell, "style"))) {
+    xml_attr(target_cell, "style") <- ""
+  }
   if (!is.null(width)) {
     xml_attr(target_cell, "style") <- paste0(xml_attr(target_cell, "style"),
                                              "width: ", width, "; ")
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/kable_styling.R b/R/kable_styling.R
index 75dd545..f3f9136 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -478,13 +478,13 @@
   col_max_length <- apply(size_matrix, 1, max) + 4
   if (table_info$table_env) {
     option <- sprintf("\\\\begin\\{wraptable\\}\\{%s\\}", option)
-    option <- paste0(option, "\\{",sum(col_max_length) * 0.15, "cm\\}")
+    option <- paste0(option, "\\{0pt\\}")
     x <- sub("\\\\begin\\{table\\}\\[\\!h\\]", "\\\\begin\\{table\\}", x)
     x <- sub("\\\\begin\\{table\\}", option, x)
     x <- sub("\\\\end\\{table\\}", "\\\\end\\{wraptable\\}", x)
   } else {
     option <- sprintf("\\begin{wraptable}{%s}", option)
-    option <- paste0(option, "{",sum(col_max_length) * 0.15, "cm}")
+    option <- paste0(option, "{0pt}")
     x <- paste0(option, x, "\\end{wraptable}")
   }
   return(x)
diff --git a/R/magic_mirror.R b/R/magic_mirror.R
index 5c2a942..09eea05 100644
--- a/R/magic_mirror.R
+++ b/R/magic_mirror.R
@@ -72,22 +72,21 @@
   } else {
     kable_info$caption <- str_sub(kable_info$caption, 1, -2)
   }
-  # N of rows
-  kable_info$nrow <- str_count(kable_input, "\\\\\n") -
-    # in the dev version (currently as of 11.2015) of knitr, when longtable is
-    # enabled, caption is moved inside the tabular environment. As a result,
-    # the number of rows should be adjusted.
-    ifelse(
-      kable_info$tabular == "longtable" & !is.na(kable_info$caption) &
-        !str_detect(kable_input, "\\\\begin\\{table\\}\\n\\n\\\\caption"),
-      1,0
-    )
   # Contents
   kable_info$contents <- str_match_all(kable_input, "\n(.*)\\\\\\\\")[[1]][,2]
   kable_info$contents <- regex_escape(kable_info$contents, T)
-  if (kable_info$tabular == "longtable" & !is.na(kable_info$caption)) {
+  if (kable_info$tabular == "longtable" & !is.na(kable_info$caption) &
+      !str_detect(kable_input, "\\\\begin\\{table\\}\\n\\n\\\\caption")) {
     kable_info$contents <- kable_info$contents[-1]
   }
+  if (!is.null(attr(kable_input, "n_head"))) {
+    n_head <- attr(kable_input, "n_head")
+    kable_info$new_header_row <- kable_info$contents[seq(n_head - 1, 1)]
+    kable_info$contents <- kable_info$contents[-seq(1, n_head - 1)]
+    kable_info$header_df <- extra_header_to_header_df(kable_info$new_header_row)
+    kable_info$new_header_row <- paste0(kable_info$new_header_row, "\\\\\\\\")
+  }
+  kable_info$nrow <- length(kable_info$contents)
   kable_info$duplicated_rows <- (sum(duplicated(kable_info$contents)) != 0)
   # Column names
   if (kable_info$booktabs & !grepl("\\\\midrule", kable_input)) {
@@ -104,9 +103,24 @@
 
   kable_info$table_env <- (!is.na(kable_info$caption) &
                              kable_info$tabular != "longtable")
+
   return(kable_info)
 }
 
+extra_header_to_header_df <- function(extra_header_rows) {
+  lapply(str_split(extra_header_rows, " \\& "), function(x) {
+    as.data.frame(t(sapply(x, extra_header_to_header_df_)), row.names = NA)
+  })
+}
+
+extra_header_to_header_df_ <- function(x) {
+  if (trimws(x) == "") return(c(header = " ", colspan = "1"))
+  x <- trimws(x)
+  x_header <- str_match(x, "([^\\}\\{]*)\\\\\\}$")[2]
+  x_colspan <- str_match(x, "^\\\\\\\\multicolumn\\\\\\{([^\\\\\\}]*)")[2]
+  return(c(header = x_header, colspan = x_colspan))
+}
+
 # Magic Mirror for html table --------
 magic_mirror_html <- function(kable_input){
   kable_info <- list()
diff --git a/R/row_spec.R b/R/row_spec.R
index 07962ed..638c611 100644
--- a/R/row_spec.R
+++ b/R/row_spec.R
@@ -122,6 +122,9 @@
 xml_cell_style <- function(x, bold, italic, monospace,
                            underline, strikeout, color, background,
                            align, font_size, angle, extra_css) {
+  if (is.na(xml_attr(x, "style"))) {
+    xml_attr(x, "style") <- ""
+  }
   if (bold) {
     xml_attr(x, "style") <- paste0(xml_attr(x, "style"),
                                    "font-weight: bold;")
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/README.md b/README.md
index e3d8073..ffba70f 100644
--- a/README.md
+++ b/README.md
@@ -66,8 +66,9 @@
 ## More Information
 For more information, please check the package vignette.
 
-- [Create Awesome HTML Table with `knitr::kable()` and kableExtra](http://haozhu233.github.io/kableExtra/awesome_table_in_html.html)
+- [Create Awesome HTML Table with `knitr::kable()` and kableExtra](http://haozhu233.github.io/kableExtra/awesome_table_in_html.html) ([中文](http://haozhu233.github.io/kableExtra/awesome_table_in_html_cn.html))
 - [Create Awesome LaTeX Table with `knitr::kable()` and kableExtra](http://haozhu233.github.io/kableExtra/awesome_table_in_pdf.pdf)
 
+
 ## Acknowledgement
 I would like to thank colleagues at [Hebrew SeniorLife Institute for Aging Research](https://www.instituteforagingresearch.org/) and the [Boston Pepper Center](http://pepper.bwh.harvard.edu/) for their input. I also would like to appreciate the mentorship from Tom Travison ([@tgt75](https://twitter.com/tgt75)) and all the efforts from the open source community, which help this package keep getting better.
diff --git a/docs/awesome_table_in_html_cn.Rmd b/docs/awesome_table_in_html_cn.Rmd
index 3e6272f..8005382 100644
--- a/docs/awesome_table_in_html_cn.Rmd
+++ b/docs/awesome_table_in_html_cn.Rmd
@@ -207,7 +207,7 @@
 ```
 <script>
 $(document).ready(function(){
-    $('[data-toggle="tooltip"]').tooltip(); 
+$('[data-toggle="tooltip"]').tooltip(); 
 });
 </script>
 ```
@@ -218,14 +218,14 @@
 ```
 <script>
 $(document).ready(function(){
-    $('[data-toggle="popover"]').popover(); 
+$('[data-toggle="popover"]').popover(); 
 });
 </script>
 ```
 
 <script>
 $(document).ready(function(){
-    $('[data-toggle="popover"]').popover(); 
+$('[data-toggle="popover"]').popover(); 
 });
 </script>
 
@@ -315,7 +315,7 @@
 ```{r}
 kable(dt, "html") %>%
   kable_styling("striped", full_width = F) %>%
-  group_rows("Group 1", 3, 5, label_row_css = "background-color: #666; color: #fff;")
+  group_rows("Group 1", 3, 5, label_row_css = "background: repeating-linear-gradient(45deg, #d9230f, #d9230f 10px, #f96352 10px, #f96352 20px); color: #fff;")
 ```
 
 ### 行的缩进
@@ -331,9 +331,9 @@
 
 ```{r}
 collapse_rows_dt <- data.frame(C1 = c(rep("a", 10), rep("b", 5)),
-                 C2 = c(rep("c", 7), rep("d", 3), rep("c", 2), rep("d", 3)),
-                 C3 = 1:15,
-                 C4 = sample(c(0,1), 15, replace = TRUE))
+                               C2 = c(rep("c", 7), rep("d", 3), rep("c", 2), rep("d", 3)),
+                               C3 = 1:15,
+                               C4 = sample(c(0,1), 15, replace = TRUE))
 kable(collapse_rows_dt, "html", align = "c") %>%
   kable_styling(full_width = F) %>%
   column_spec(1, bold = T) %>%
@@ -351,7 +351,7 @@
            number = c("Footnote 1; ", "Footnote 2; "),
            alphabet = c("Footnote A; ", "Footnote B; "),
            symbol = c("Footnote Symbol 1; ", "Footnote Symbol 2")
-           )
+  )
 ```
 
 要是想要修改每一类的标题的话,你可以使用那些`***_title`变量. 你还可以通过 `footnote_order`来更改他们的顺序. 你甚至可以通过`footnote_as_chunk`,让备注们以一个段落的方式显示.
@@ -366,7 +366,7 @@
            general_title = "备注: ", number_title = "备注233: ",
            alphabet_title = "备注666: ", symbol_title = "备注888: ",
            footnote_as_chunk = T
-           )
+  )
 ```
 
 若是想在表格内部添加注释的小字的话,你需要使用那些`footnote_mark_***()`方程. 和 `cell_spec`一样,你需要告诉他们你想要的格式(在今后的版本里你不需要了)同时在使用`kable`的时候往里加上`escape=F`。
@@ -376,7 +376,7 @@
 names(dt_footnote)[2] <- paste0(names(dt_footnote)[2], 
                                 footnote_marker_symbol(1))
 row.names(dt_footnote)[4] <- paste0(row.names(dt_footnote)[4], 
-                                footnote_marker_alphabet(1))
+                                    footnote_marker_alphabet(1))
 kable(dt_footnote, "html", align = "c", 
       # Remember this escape = F
       escape = F) %>%
@@ -396,3 +396,13 @@
   kable_styling() %>%
   scroll_box(width = "500px", height = "200px")
 ```
+
+另外,除了一个具体的宽度或者高度,你也可以选择百分比哦。比如`width="100%"`就很实用。另外不喜欢默认的灰色直角框,你也可以通过定义`box_css`把消掉或者替换掉。
+```{r}
+kable(cbind(mtcars, mtcars)[1:5, ], "html") %>%
+  kable_styling() %>%
+  scroll_box(width = "100%", box_css = '
+padding: 15px; border: 15px solid transparent;
+background: linear-gradient(white,white), repeating-linear-gradient(45deg, #d9230f, #d9230f 10px, #f96352 10px, #f96352 20px);
+background-clip: padding-box, border-box;')
+```
diff --git a/docs/awesome_table_in_html_cn.html b/docs/awesome_table_in_html_cn.html
index 49c1e66..4e97123 100644
--- a/docs/awesome_table_in_html_cn.html
+++ b/docs/awesome_table_in_html_cn.html
@@ -11,7 +11,7 @@
 
 <meta name="author" content="朱昊" />
 
-<meta name="date" content="2018-04-14" />
+<meta name="date" content="2018-04-24" />
 
 <title>用kableExtra做牛*的表格</title>
 
@@ -219,7 +219,7 @@
 
 <h1 class="title toc-ignore">用kableExtra做牛*的表格</h1>
 <h4 class="author"><em>朱昊</em></h4>
-<h4 class="date"><em>2018-04-14</em></h4>
+<h4 class="date"><em>2018-04-24</em></h4>
 
 </div>
 
@@ -2314,7 +2314,7 @@
 <p>你可以通过<code>cell_spec</code>相对简单地添加悬浮提示框. 举个例子,<code>text_spec(&quot;tooltip&quot;, color = &quot;red&quot;, tooltip = &quot;Hello World&quot;)</code> 会生成 <span style="     color: red;" data-toggle="tooltip" data-placement="right" title="Hello World">Hover over me</span>。注意HTML原生的提示框非常慢,你可能会想用<code>bootstrap</code>的javascript版的。如果你想这么做的话,你需要把接下来的这段代码放在你的rmarkdown文本的任何地方。需要注意的是,如果你和这个文档一样使用了这种目录在侧面的格式,你就没办法使用这个功能。原因在于这个和<code>jqueryui</code>的<code>tooltip</code>互相冲突。这种情况下,你可能会想试试我下面说的<code>popover</code>。这两个差不多。</p>
 <pre><code>&lt;script&gt;
 $(document).ready(function(){
-    $('[data-toggle=&quot;tooltip&quot;]').tooltip(); 
+$('[data-toggle=&quot;tooltip&quot;]').tooltip(); 
 });
 &lt;/script&gt;</code></pre>
 </div>
@@ -2323,12 +2323,12 @@
 <p>和之前一样的设定,区别在于你可以给<code>popover</code>的小框加一个标题。不加的话,和上面的功能基本一样。</p>
 <pre><code>&lt;script&gt;
 $(document).ready(function(){
-    $('[data-toggle=&quot;popover&quot;]').popover(); 
+$('[data-toggle=&quot;popover&quot;]').popover(); 
 });
 &lt;/script&gt;</code></pre>
 <script>
 $(document).ready(function(){
-    $('[data-toggle="popover"]').popover(); 
+$('[data-toggle="popover"]').popover(); 
 });
 </script>
 <pre class="r"><code>popover_dt &lt;- data.frame(
@@ -3190,7 +3190,7 @@
 <p>如果你熟悉CSS,你可以自己定义标签行的样式。</p>
 <pre class="r"><code>kable(dt, &quot;html&quot;) %&gt;%
   kable_styling(&quot;striped&quot;, full_width = F) %&gt;%
-  group_rows(&quot;Group 1&quot;, 3, 5, label_row_css = &quot;background-color: #666; color: #fff;&quot;)</code></pre>
+  group_rows(&quot;Group 1&quot;, 3, 5, label_row_css = &quot;background: repeating-linear-gradient(45deg, #d9230f, #d9230f 10px, #f96352 10px, #f96352 20px); color: #fff;&quot;)</code></pre>
 <table class="table table-striped" style="width: auto !important; margin-left: auto; margin-right: auto;">
 <thead>
 <tr>
@@ -3264,7 +3264,7 @@
 </td>
 </tr>
 <tr grouplength="3">
-<td colspan="7" style="background-color: #666; color: #fff;">
+<td colspan="7" style="background: repeating-linear-gradient(45deg, #d9230f, #d9230f 10px, #f96352 10px, #f96352 20px); color: #fff;">
 <strong>Group 1</strong>
 </td>
 </tr>
@@ -3494,9 +3494,9 @@
 <h3>合并行</h3>
 <p><code>collapse_rows</code> 做的就是我们之前说的第二种在表格内表示所属关系的方法。请看下面的例子,第一二两列所有重复的内容都被自动合并了。</p>
 <pre class="r"><code>collapse_rows_dt &lt;- data.frame(C1 = c(rep(&quot;a&quot;, 10), rep(&quot;b&quot;, 5)),
-                 C2 = c(rep(&quot;c&quot;, 7), rep(&quot;d&quot;, 3), rep(&quot;c&quot;, 2), rep(&quot;d&quot;, 3)),
-                 C3 = 1:15,
-                 C4 = sample(c(0,1), 15, replace = TRUE))
+                               C2 = c(rep(&quot;c&quot;, 7), rep(&quot;d&quot;, 3), rep(&quot;c&quot;, 2), rep(&quot;d&quot;, 3)),
+                               C3 = 1:15,
+                               C4 = sample(c(0,1), 15, replace = TRUE))
 kable(collapse_rows_dt, &quot;html&quot;, align = &quot;c&quot;) %&gt;%
   kable_styling(full_width = F) %&gt;%
   column_spec(1, bold = T) %&gt;%
@@ -3554,7 +3554,7 @@
 4
 </td>
 <td style="text-align:center;">
-1
+0
 </td>
 </tr>
 <tr>
@@ -3562,7 +3562,7 @@
 5
 </td>
 <td style="text-align:center;">
-0
+1
 </td>
 </tr>
 <tr>
@@ -3578,7 +3578,7 @@
 7
 </td>
 <td style="text-align:center;">
-0
+1
 </td>
 </tr>
 <tr>
@@ -3597,7 +3597,7 @@
 9
 </td>
 <td style="text-align:center;">
-0
+1
 </td>
 </tr>
 <tr>
@@ -3605,7 +3605,7 @@
 10
 </td>
 <td style="text-align:center;">
-0
+1
 </td>
 </tr>
 <tr>
@@ -3638,7 +3638,7 @@
 13
 </td>
 <td style="text-align:center;">
-0
+1
 </td>
 </tr>
 <tr>
@@ -3654,7 +3654,7 @@
 15
 </td>
 <td style="text-align:center;">
-0
+1
 </td>
 </tr>
 </tbody>
@@ -3671,7 +3671,7 @@
            number = c(&quot;Footnote 1; &quot;, &quot;Footnote 2; &quot;),
            alphabet = c(&quot;Footnote A; &quot;, &quot;Footnote B; &quot;),
            symbol = c(&quot;Footnote Symbol 1; &quot;, &quot;Footnote Symbol 2&quot;)
-           )</code></pre>
+  )</code></pre>
 <table class="table" style="width: auto !important; margin-left: auto; margin-right: auto;">
 <thead>
 <tr>
@@ -3867,7 +3867,7 @@
            general_title = &quot;备注: &quot;, number_title = &quot;备注233: &quot;,
            alphabet_title = &quot;备注666: &quot;, symbol_title = &quot;备注888: &quot;,
            footnote_as_chunk = T
-           )</code></pre>
+  )</code></pre>
 <table class="table" style="width: auto !important; margin-left: auto; margin-right: auto;">
 <thead>
 <tr>
@@ -4038,7 +4038,7 @@
 names(dt_footnote)[2] &lt;- paste0(names(dt_footnote)[2], 
                                 footnote_marker_symbol(1))
 row.names(dt_footnote)[4] &lt;- paste0(row.names(dt_footnote)[4], 
-                                footnote_marker_alphabet(1))
+                                    footnote_marker_alphabet(1))
 kable(dt_footnote, &quot;html&quot;, align = &quot;c&quot;, 
       # Remember this escape = F
       escape = F) %&gt;%
@@ -6561,6 +6561,449 @@
 </tbody>
 </table>
 </div>
+<p>另外,除了一个具体的宽度或者高度,你也可以选择百分比哦。比如<code>width=&quot;100%&quot;</code>就很实用。另外不喜欢默认的灰色直角框,你也可以通过定义<code>box_css</code>把消掉或者替换掉。</p>
+<pre class="r"><code>kable(cbind(mtcars, mtcars)[1:5, ], &quot;html&quot;) %&gt;%
+  kable_styling() %&gt;%
+  scroll_box(width = &quot;100%&quot;, box_css = '
+padding: 15px; border: 15px solid transparent;
+background: linear-gradient(white,white), repeating-linear-gradient(45deg, #d9230f, #d9230f 10px, #f96352 10px, #f96352 20px);
+background-clip: padding-box, border-box;')</code></pre>
+<div style="
+padding: 15px; border: 15px solid transparent;
+background: linear-gradient(white,white), repeating-linear-gradient(45deg, #d9230f, #d9230f 10px, #f96352 10px, #f96352 20px);
+background-clip: padding-box, border-box;overflow-x: scroll; width:100%; ">
+<table class="table" style="margin-left: auto; margin-right: auto;">
+<thead>
+<tr>
+<th style="text-align:left;">
+</th>
+<th style="text-align:right;">
+mpg
+</th>
+<th style="text-align:right;">
+cyl
+</th>
+<th style="text-align:right;">
+disp
+</th>
+<th style="text-align:right;">
+hp
+</th>
+<th style="text-align:right;">
+drat
+</th>
+<th style="text-align:right;">
+wt
+</th>
+<th style="text-align:right;">
+qsec
+</th>
+<th style="text-align:right;">
+vs
+</th>
+<th style="text-align:right;">
+am
+</th>
+<th style="text-align:right;">
+gear
+</th>
+<th style="text-align:right;">
+carb
+</th>
+<th style="text-align:right;">
+mpg
+</th>
+<th style="text-align:right;">
+cyl
+</th>
+<th style="text-align:right;">
+disp
+</th>
+<th style="text-align:right;">
+hp
+</th>
+<th style="text-align:right;">
+drat
+</th>
+<th style="text-align:right;">
+wt
+</th>
+<th style="text-align:right;">
+qsec
+</th>
+<th style="text-align:right;">
+vs
+</th>
+<th style="text-align:right;">
+am
+</th>
+<th style="text-align:right;">
+gear
+</th>
+<th style="text-align:right;">
+carb
+</th>
+</tr>
+</thead>
+<tbody>
+<tr>
+<td style="text-align:left;">
+Mazda RX4
+</td>
+<td style="text-align:right;">
+21.0
+</td>
+<td style="text-align:right;">
+6
+</td>
+<td style="text-align:right;">
+160
+</td>
+<td style="text-align:right;">
+110
+</td>
+<td style="text-align:right;">
+3.90
+</td>
+<td style="text-align:right;">
+2.620
+</td>
+<td style="text-align:right;">
+16.46
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+21.0
+</td>
+<td style="text-align:right;">
+6
+</td>
+<td style="text-align:right;">
+160
+</td>
+<td style="text-align:right;">
+110
+</td>
+<td style="text-align:right;">
+3.90
+</td>
+<td style="text-align:right;">
+2.620
+</td>
+<td style="text-align:right;">
+16.46
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+4
+</td>
+</tr>
+<tr>
+<td style="text-align:left;">
+Mazda RX4 Wag
+</td>
+<td style="text-align:right;">
+21.0
+</td>
+<td style="text-align:right;">
+6
+</td>
+<td style="text-align:right;">
+160
+</td>
+<td style="text-align:right;">
+110
+</td>
+<td style="text-align:right;">
+3.90
+</td>
+<td style="text-align:right;">
+2.875
+</td>
+<td style="text-align:right;">
+17.02
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+21.0
+</td>
+<td style="text-align:right;">
+6
+</td>
+<td style="text-align:right;">
+160
+</td>
+<td style="text-align:right;">
+110
+</td>
+<td style="text-align:right;">
+3.90
+</td>
+<td style="text-align:right;">
+2.875
+</td>
+<td style="text-align:right;">
+17.02
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+4
+</td>
+</tr>
+<tr>
+<td style="text-align:left;">
+Datsun 710
+</td>
+<td style="text-align:right;">
+22.8
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+108
+</td>
+<td style="text-align:right;">
+93
+</td>
+<td style="text-align:right;">
+3.85
+</td>
+<td style="text-align:right;">
+2.320
+</td>
+<td style="text-align:right;">
+18.61
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+22.8
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+108
+</td>
+<td style="text-align:right;">
+93
+</td>
+<td style="text-align:right;">
+3.85
+</td>
+<td style="text-align:right;">
+2.320
+</td>
+<td style="text-align:right;">
+18.61
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+4
+</td>
+<td style="text-align:right;">
+1
+</td>
+</tr>
+<tr>
+<td style="text-align:left;">
+Hornet 4 Drive
+</td>
+<td style="text-align:right;">
+21.4
+</td>
+<td style="text-align:right;">
+6
+</td>
+<td style="text-align:right;">
+258
+</td>
+<td style="text-align:right;">
+110
+</td>
+<td style="text-align:right;">
+3.08
+</td>
+<td style="text-align:right;">
+3.215
+</td>
+<td style="text-align:right;">
+19.44
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+3
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+21.4
+</td>
+<td style="text-align:right;">
+6
+</td>
+<td style="text-align:right;">
+258
+</td>
+<td style="text-align:right;">
+110
+</td>
+<td style="text-align:right;">
+3.08
+</td>
+<td style="text-align:right;">
+3.215
+</td>
+<td style="text-align:right;">
+19.44
+</td>
+<td style="text-align:right;">
+1
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+3
+</td>
+<td style="text-align:right;">
+1
+</td>
+</tr>
+<tr>
+<td style="text-align:left;">
+Hornet Sportabout
+</td>
+<td style="text-align:right;">
+18.7
+</td>
+<td style="text-align:right;">
+8
+</td>
+<td style="text-align:right;">
+360
+</td>
+<td style="text-align:right;">
+175
+</td>
+<td style="text-align:right;">
+3.15
+</td>
+<td style="text-align:right;">
+3.440
+</td>
+<td style="text-align:right;">
+17.02
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+3
+</td>
+<td style="text-align:right;">
+2
+</td>
+<td style="text-align:right;">
+18.7
+</td>
+<td style="text-align:right;">
+8
+</td>
+<td style="text-align:right;">
+360
+</td>
+<td style="text-align:right;">
+175
+</td>
+<td style="text-align:right;">
+3.15
+</td>
+<td style="text-align:right;">
+3.440
+</td>
+<td style="text-align:right;">
+17.02
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+0
+</td>
+<td style="text-align:right;">
+3
+</td>
+<td style="text-align:right;">
+2
+</td>
+</tr>
+</tbody>
+</table>
+</div>
 </div>
 </div>
 
diff --git a/docs/index.html b/docs/index.html
index 5435902..11132c5 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -82,7 +82,7 @@
         <ul>
           <li>
             <a href="awesome_table_in_html.html" class="normal-link">for HTML</a> /
-            <a href="awesome_table_in_html_cn.html" class="normal-link"><span style="border-radius: 2px; padding: 1px; background-color: #d14; font-size: 8px; color: #fff">中</span></a>
+            <a href="awesome_table_in_html_cn.html" class="normal-link"><span style="border-radius: 2px; padding: 1px; background-color: #d14; font-size: 8px; color: #fff">中文</span></a>
           </li>
           <li>
             <a href="awesome_table_in_pdf.pdf" class="normal-link">for LaTeX</a>
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
+}