improve html grouped header row
diff --git a/R/add_header_above.R b/R/add_header_above.R
index e50261e..92e2040 100644
--- a/R/add_header_above.R
+++ b/R/add_header_above.R
@@ -69,8 +69,12 @@
htmlTable_new_header_generator <- function(header_df) {
header_items <- apply(header_df, 1, function(x) {
- paste0('<th style="text-align:center;" colspan="', x[2], '">',
- x[1], '</th>')
+ if (x[2] == 1 | trimws(x[1]) == "") {
+ paste0('<th style="border-bottom:hidden"></th>')
+ } else {
+ paste0('<th style="text-align:center;" colspan="', x[2], '">',
+ x[1], '</th>')
+ }
})
header_text <- paste(c("<tr>", header_items, "</tr>"), collapse = "")
header_xml <- read_xml(header_text, options = c("COMPACT"))
diff --git a/docs/awesome_table_in_html.html b/docs/awesome_table_in_html.html
index 949666c..d88d6fc 100644
--- a/docs/awesome_table_in_html.html
+++ b/docs/awesome_table_in_html.html
@@ -1602,15 +1602,14 @@
<table class="table table-striped" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
-<th style="text-align:center;" colspan="1">
-</th>
-<th style="text-align:center;" colspan="2">
+<th style="border-bottom:hidden"></th>
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="2">
Group 1
</th>
-<th style="text-align:center;" colspan="2">
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="2">
Group 2
</th>
-<th style="text-align:center;" colspan="2">
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="2">
Group 3
</th>
</tr>
@@ -1765,32 +1764,29 @@
<table class="table table-striped table-bordered" style="margin-left: auto; margin-right: auto;">
<thead>
<tr>
-<th style="text-align:center;" colspan="1">
-</th>
-<th style="text-align:center;" colspan="6">
+<th style="border-bottom:hidden"></th>
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="6">
Group 6
</th>
</tr>
<tr>
-<th style="text-align:center;" colspan="1">
-</th>
-<th style="text-align:center;" colspan="4">
+<th style="border-bottom:hidden"></th>
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="4">
Group 4
</th>
-<th style="text-align:center;" colspan="2">
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="2">
Group 5
</th>
</tr>
<tr>
-<th style="text-align:center;" colspan="1">
-</th>
-<th style="text-align:center;" colspan="2">
+<th style="border-bottom:hidden"></th>
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="2">
Group 1
</th>
-<th style="text-align:center;" colspan="2">
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="2">
Group 2
</th>
-<th style="text-align:center;" colspan="2">
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="2">
Group 3
</th>
</tr>
@@ -2450,12 +2446,11 @@
</caption>
<thead>
<tr>
-<th style="text-align:center;" colspan="1">
-</th>
-<th style="text-align:center;" colspan="3">
+<th style="border-bottom:hidden"></th>
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="3">
Group 1<sup>†</sup>
</th>
-<th style="text-align:center;" colspan="3">
+<th style="text-align:center;border-collapse: separate !important; margin-right: 10px !important;" colspan="3">
Group 2<sup>‡</sup>
</th>
</tr>
diff --git a/inst/NEWS b/inst/NEWS
index 4c6ed76..ba959ec 100644
--- a/inst/NEWS
+++ b/inst/NEWS
@@ -3,7 +3,9 @@
* Added `column_spec()` to customize the look of the selected column.
-* Improve language in docs.
+* Improved the look of HTML grouped header row.
+
+* Fixed an error in a documentation.
kableExtra 0.2.0
--------------------------------------------------------------------------------
diff --git a/man/column_spec.Rd b/man/column_spec.Rd
index ecfb48a..d7a08ec 100644
--- a/man/column_spec.Rd
+++ b/man/column_spec.Rd
@@ -4,7 +4,7 @@
\alias{column_spec}
\title{Specify the look of the selected column}
\usage{
-column_spec(kable_input, column, width, bold = F, italic = F)
+column_spec(kable_input, column, width = NULL, bold = F, italic = F)
}
\arguments{
\item{kable_input}{Output of `knitr::kable()` with `format` specified}