Closed joshuaulrich closed 7 months ago
kable_classic()
is documented to be a way to obtain an alternate HTML theme, so it makes sense that the output should be HTML.
To do what you want, I think you'll have to write your own wrapper, something like this:
old_kable_classic <- function(kable_input, ...) {
if (attr(kable_input, "format") == "pipe") kable_input else kable_classic(kable_input, ...)
}
Thanks for the quick reply! I figured it was a bug fix based on the documentation, but wanted to report it in case kable_classic()
was supposed to do what your wrapper does.
In version 1.3.4
kable_classic
created a pipe-delimited text table when theknitr_kable
object's format is "pipe". It creates a HTML table in version 1.4.0. I'm not sure if this is a regression or an intended change.This matters for me because I knit the same document as PDF (to send to others for feedback) and markdown (for Hugo). The call to
kable_classic()
throws an error when rendering markdown because I usemd_document(preserve_yaml = TRUE, pandoc_args = c("--to=markdown_strict+[other args]"))
when creating the markdown document for Hugo.I use this command to knit:
The error is:
I can't us
always_allow_html: true
because then the tables do not appear inoutput.md
. Here's my full Rmd:Rscript -e 'rmarkdown::render("input.Rmd", rmarkdown::md_document(preserve_yaml = TRUE, pandoc_args = c("--to=markdown_strict+all_symbols_escapable+backtick_code_blocks+fenced_code_blocks+space_in_atx_header+intraword_underscores+lists_without_preceding_blankline+shortcut_reference_links+pipe_tables+strikeout+autolink_bare_uris+task_lists+definition_lists+footnotes+smart+tex_math_dollars", "--wrap=none")), "output.md")'
...but creates an HTML table in kableExtra_1.4.0.