-
-
Notifications
You must be signed in to change notification settings - Fork 147
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Blank table in Rmarkdown inline rendering with dark-themed Rstudio #689
Comments
Also have been having this issue. So frustrating! |
This continues to be an issue, but there's a temporary workaround here. You can inject print.kableExtra <- function (x, ...) {
view_html <- getOption("kableExtra_view_html", TRUE)
if (view_html & interactive()) {
dep <- list(
rmarkdown::html_dependency_jquery(),
rmarkdown::html_dependency_bootstrap(theme = "cosmo"),
kableExtra::html_dependency_kePrint(),
kableExtra::html_dependency_lightable()
)
x <- sub('style="', 'style="color: black; ', as.character(x), fixed = TRUE)
html_kable <- htmltools::browsable(
htmltools::HTML(
as.character(x),
"<script type=\"text/x-mathjax-config\">MathJax.Hub.Config({tex2jax: {inlineMath: [[\"$\",\"$\"]]}})</script><script async src=\"https://mathjax.rstudio.com/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML\"></script>"
)
)
htmltools::htmlDependencies(html_kable) <- dep
class(html_kable) <- "shiny.tag.list"
print(html_kable)
}
else {
cat(as.character(x))
}
} This fixes things when working with a dark theme. Before (using the Monokai theme in RStudio): After running new You can include the new This is a good temporary solution, but it would be cool to someday have |
@haozhu233 Would adding Lines 2 to 23 in a6af5c0
…mess things up in light themes or other non-RStudio editors, or would that be a safe change? I'd be happy to open a PR if it's safe. Thanks! |
FWIW, I think a "cleaner" fix would be to add this code on line 267 of # issue 689: invisible font in Rstudio dark theme
flag <- tryCatch(rstudioapi::getThemeInfo()$dark, error = function(e) FALSE)
if (isTRUE(flag)) {
kable_xml_style <- c(kable_xml_style, "color: black;")
} I'd be curious if anyone could try it and let me know if it works on their computer as well. You can try my fork by calling: remotes::install_github("vincentarelbundock/kableExtra@dev") Restart R completely, and try again. |
Fixed here: #768 |
Hi, I'm having an issue exactly described here :
vincentarelbundock/modelsummary#269
The author seems to have solved the issue by using
kable()
instead ofkbl()
, but forgot to raise it here.The text was updated successfully, but these errors were encountered: