quarto-dev / quarto-cli

Open-source scientific and technical publishing system built on Pandoc.
https://quarto.org
Other
3.97k stars 328 forks source link

kableExtra tables not processing markdown #1710

Open debruine opened 2 years ago

debruine commented 2 years ago

Bug description

Tables with markdown or html have to have escape = FALSE to not show the markdown or html verbatim when displaying in a table with kable().

Reprex of the problem:

---
title: "kableExtra Escape Reprex"
format: html
---

Create table with markdown and html links:

```{r}
tbl <- data.frame(
  markdown = "[github](https://github.com)",
  html = "<a href='https://github.com'>github</a>"
)

Both work with knitr::kable()

knitr::kable(tbl, escape = FALSE) 

The markdown version doesn't work with kableExtra::kable()

kableExtra::kable(tbl, escape = FALSE) 

But if you unclass() and cat() the result, it does work:

kableExtra::kable(tbl, escape = FALSE) |>
  unclass() |> cat()

<img width="828" alt="kableExtra-quarto" src="https://user-images.githubusercontent.com/14863295/183250174-150280f1-7c43-4d60-887f-5bd8ac6c338c.png">

### `quarto check` Output

FYI: for RStudio users who aren't familiar with the command line, you might want to instruct them to paste the output of `quarto::quarto_path() |> paste("check") |> system()`.

```bash
[✓] Checking Quarto installation......OK
      Version: 1.0.36
      Path: /Applications/RStudio.app/Contents/MacOS/quarto/bin

[✓] Checking basic markdown render....OK

[✓] Checking Python 3 installation....OK
      Version: 3.7.3
      Path: /Applications/Xcode.app/Contents/Developer/usr/bin/python3
      Jupyter: (None)

      Jupyter is not available in this Python installation.
      Install with python3 -m pip install jupyter

[✓] Checking R installation...........OK
      Version: 4.2.0
      Path: /Library/Frameworks/R.framework/Resources
      LibPaths:
        - /Library/Frameworks/R.framework/Versions/4.2/Resources/library
      rmarkdown: 2.14

[✓] Checking Knitr engine render......OK

I'm running RStudio 2022.07.1 Build 554 "Spotted Wakerobin" Release (7872775e, 2022-07-22) for macOS Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) QtWebEngine/5.12.10 Chrome/69.0.3497.128 Safari/537.36

quarto tools check Output

[✓] Inspecting tools

Tool         Status                    Installed     Latest  
chromium     Not installed             ---           869685  
tinytex      External Installation     ---           v2022.08

Checklist

norcalbiostat commented 2 years ago

Thank you for adding this clear example. I have been trying for a few weeks to find the right place to get an answer to this problem.

jjallaire commented 2 years ago

The kableExtra package might require some updates to detect when its running in pandoc and emit the requisite raw markdown or HTML