quarto-dev / quarto-dev/quarto-cli

kableExtra tables not processing markdown

Open
#1,710 2 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

bug tables third-party
Dominant language
JavaScript
Stars
6k
Forks
458
Avg merge
1d 9h
Merged PRs (30d)
41

Description

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().

  • If you you display the table with knitr::kable(), both types of links display correctly as links
  • If you use kableExtra::kable(), the markdown version just shows the markdown verbatim
  • However, if you unclass() the result of the kableExtra version, it does display markdown links correctly
  • The reprex below shows these problems in a .qmd file, but not if knit in an .Rmd file

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()

```{r, results='asis'}
knitr::kable(tbl, escape = FALSE) 
```

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

```{r, results='asis'}
kableExtra::kable(tbl, escape = FALSE) 
```

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

```{r, results='asis'}
kableExtra::kable(tbl, escape = FALSE) |>
  unclass() |> cat()
```
kableExtra-quarto
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().

[✓] 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
  • formatted your issue so it is easier for us to read?
  • included a minimal, fully reproducible example in a single .qmd file? Please provide the whole file rather than the snippet you believe is causing the issue.
  • documented the quarto version you're running, by pasting the output from running quarto check in the "Quarto Check Output" text area?
  • documented the version of the quarto tools you're running, by providing the output from running quarto tools check in the "Quarto Tools Check Output" text area?
  • documented the RStudio IDE version you're running (if applicable), by providing the value displayed in the "About RStudio" main menu dialog?
  • documented which operating system you're running? If on Linux, please provide the specific distribution as well.
  • upgraded to the latest version, including your versions of R, the RStudio IDE, and relevant R packages?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the included .qmd reprex and comparing knitr::kable() with kableExtra::kable() in Quarto HTML output. Trace how the kableExtra result is processed, including the unclass() and cat() comparison; done means markdown links render as links without that workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
html, markdown, r
Domain
content, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.