Skip to content
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

kableExtra tables not processing markdown #1710

Open
7 tasks done
debruine opened this issue Aug 6, 2022 · 2 comments
Open
7 tasks done

kableExtra tables not processing markdown #1710

debruine opened this issue Aug 6, 2022 · 2 comments
Labels
bug Something isn't working tables Issues with Tables including the gt integration
Milestone

Comments

@debruine
Copy link

debruine commented Aug 6, 2022

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?
@debruine debruine added the bug Something isn't working label Aug 6, 2022
@norcalbiostat
Copy link

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
Copy link
Collaborator

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working tables Issues with Tables including the gt integration
Projects
None yet
Development

No branches or pull requests

4 participants