Fix #229
diff --git a/R/kable_styling.R b/R/kable_styling.R
index f3f9136..5dc7c25 100644
--- a/R/kable_styling.R
+++ b/R/kable_styling.R
@@ -502,7 +502,7 @@
# fontsize is good enough
return(paste0(
"\\begingroup\\fontsize{", font_size, "}{", row_height, "}\\selectfont\n", x,
- "\\endgroup{}"
+ "\n\\endgroup{}"
))
}
diff --git a/R/print.R b/R/print.R
index 7752d98..344d43d 100644
--- a/R/print.R
+++ b/R/print.R
@@ -10,7 +10,7 @@
if (interactive() & rstudioapi::isAvailable()) {
htmltools::html_print(html_result, viewer = rstudioapi::viewer)
}
- print(html_result)
+ # print(html_result)
}
#' HTML dependency for js script to enable bootstrap tooltip and popup message
diff --git a/docs/awesome_table_in_html.Rmd b/docs/awesome_table_in_html.Rmd
index 3af994c..8e9f38f 100644
--- a/docs/awesome_table_in_html.Rmd
+++ b/docs/awesome_table_in_html.Rmd
@@ -173,16 +173,17 @@
It is very easy to use `cell_spec` with conditional logic. Here is an example.
```{r, message=FALSE, warning=FALSE}
library(dplyr)
+options(knitr.table.format = "html")
mtcars[1:10, 1:2] %>%
mutate(
car = row.names(.),
- mpg = cell_spec(mpg, color = ifelse(mpg > 20, "red", "blue")),
- cyl = cell_spec(cyl, color = "white", align = "c", angle = 45,
+ mpg = cell_spec(mpg, "html", color = ifelse(mpg > 20, "red", "blue")),
+ cyl = cell_spec(cyl, "html", color = "white", align = "c", angle = 45,
background = factor(cyl, c(4, 6, 8),
c("#666666", "#999999", "#BBBBBB")))
) %>%
select(car, mpg, cyl) %>%
- kable(escape = F) %>%
+ kable(format = "html", escape = F) %>%
kable_styling("striped", full_width = F)
```
diff --git a/docs/awesome_table_in_html.html b/docs/awesome_table_in_html.html
index a2b79c7..67ba962 100644
--- a/docs/awesome_table_in_html.html
+++ b/docs/awesome_table_in_html.html
@@ -1962,16 +1962,17 @@
<h2>Conditional logic</h2>
<p>It is very easy to use <code>cell_spec</code> with conditional logic. Here is an example.</p>
<pre class="r"><code>library(dplyr)
+options(knitr.table.format = "html")
mtcars[1:10, 1:2] %>%
mutate(
car = row.names(.),
- mpg = cell_spec(mpg, color = ifelse(mpg > 20, "red", "blue")),
- cyl = cell_spec(cyl, color = "white", align = "c", angle = 45,
+ mpg = cell_spec(mpg, "html", color = ifelse(mpg > 20, "red", "blue")),
+ cyl = cell_spec(cyl, "html", color = "white", align = "c", angle = 45,
background = factor(cyl, c(4, 6, 8),
c("#666666", "#999999", "#BBBBBB")))
) %>%
select(car, mpg, cyl) %>%
- kable(escape = F) %>%
+ kable(format = "html", escape = F) %>%
kable_styling("striped", full_width = F)</code></pre>
<table class="table table-striped" style="width: auto !important; margin-left: auto; margin-right: auto;">
<thead>
@@ -3548,7 +3549,7 @@
1
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -3588,7 +3589,7 @@
6
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -3596,7 +3597,7 @@
7
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3607,7 +3608,7 @@
8
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3615,7 +3616,7 @@
9
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
<tr>
@@ -3637,7 +3638,7 @@
11
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3645,7 +3646,7 @@
12
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3656,7 +3657,7 @@
13
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3664,7 +3665,7 @@
14
</td>
<td style="text-align:center;">
-0
+1
</td>
</tr>
<tr>
@@ -3672,7 +3673,7 @@
15
</td>
<td style="text-align:center;">
-1
+0
</td>
</tr>
</tbody>
diff --git a/docs/awesome_table_in_pdf.pdf b/docs/awesome_table_in_pdf.pdf
index 90d7b15..b7ed6e8 100644
--- a/docs/awesome_table_in_pdf.pdf
+++ b/docs/awesome_table_in_pdf.pdf
Binary files differ