-
Notifications
You must be signed in to change notification settings - Fork 335
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
DT::datatable cross-referencing and captions #1084
Comments
For reference purposes, there is already a discussion item about this: #628 DT tables are part of interactive tables, and they are specific HTML widgets and not tables per-se (not Markdown tables, nor HTML tables). As answered in #782, currently, they can be reference as Figures only ---
title: "test"
format: html
execute:
echo: false
---
```{r}
d <- iris[1:20,]
```
# kable
@tbl-kable comes here.
```{r}
#| label: tbl-kable
#| tbl-cap: "kable"
knitr::kable(d)
```
# DT::datatable
@fig-datatable comes here.
```{r}
#| label: fig-datatable
#| fig-cap: "datatable"
DT::datatable(d)
``` It will be reference as Figures, but that is what is working currently. Cross reference htmlwidgets will be something added in a later version probably. It requires some specific adjustments, also considering different computation language outputs. By the way, for using references within computation chunk, it is best to use the ```{r}
#| label: tbl-datatable
#| tbl-cap: "datatable"
DT::datatable(iris)
``` |
@MarekGierlinski thanks for letting us know that interactive tables from gt have the same problem! We will ensure these tables are also handled and tested when we get to the work. |
I am still getting the "WARNING: Unable to resolve crossref @tbl-datatable" error with this code using the latest version of R and RStudio. Does this code work for anyone else? |
I was unaware of quarto prerelease versions. Works like a charm now. Thank you! |
It seems that
quarto
wants tables to be the waykable
makes them (piped/markdown style), not the JS chunks produced by, say,DT::datatable
.datatable
produces output, but captions and cross-referencing are ignored.Small example:
Unexpected output in final html is shown in attached screenshot.
Many thanks for looking into this.
Sys info:
The text was updated successfully, but these errors were encountered: