kable output broken in recent versions of rmarkdown
khughitt opened this issue · comments
Hi Jim,
Starting recently, I noticed that the output from the knitr kable
function is not being handled well. What appears to be happening is the HTML which is appended after the output follows too soon and bleeds into the table.
Manually added newlines after the kable
call does not fix the issue.
It's possible that this is an issue for rmarkdown
, but I cannot be certain and the kable
output for normal html_document
renderings looks okay.
In either case, the fix should be as simple as adding a newline somewhere in the output.
To reproduce the issue, try:
test.rmd
---
output:
knitrBootstrap::bootstrap_document:
title: "Test"
---
```{r, results='asis'}
library(knitr)
library(MASS)
kable(iris)
```
run:
library(rmarkdown)
library(knitrBootstrap)
render('test_kable.rmd', clean=FALSE)
Here is an example from the markdown where the problem is occurring:
...
6.3 2.5 5.0 1.9 virginica
6.5 3.0 5.2 2.0 virginica
6.2 3.4 5.4 2.3 virginica
5.9 3.0 5.1 1.8 virginica
</div></div></div>
<div class="navbar navbar-fixed-bottom navbar-inverse"><div class="container"><div class="navbar-header"><button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-responsive-collapse"><span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span></button></div>
...
System info
(Using Github version of knitrBootstrap...)
> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: x86_64-unknown-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C LC_TIME=en_US.UTF-8
[4] LC_COLLATE=en_US.UTF-8 LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C LC_ADDRESS=C
[10] LC_TELEPHONE=C LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] knitr_1.7 MASS_7.3-33 knitrBootstrap_1.0.0 rmarkdown_0.3.3
[5] setwidth_1.0-3 colorout_1.0-3
loaded via a namespace (and not attached):
[1] digest_0.6.4 evaluate_0.5.5 formatR_1.0 htmltools_0.2.6 markdown_0.7.4
[6] stringr_0.6.2 tools_3.1.1 yaml_2.1.13
I think this is actually a kable bug, it should output an extra newline after the table, I will submit a pull request.
Keith,
I tracked this but down and submitted a pull request to knitr, once it gets merged I will close this pull. Thank you for debugging the issue and the pull request, you made easy to figure out what was going on!
Sure thing! Thanks for the quick upstream fix!