-
Notifications
You must be signed in to change notification settings - Fork 214
Put footnotes on the same line with fmt_markdown()
in Quarto
#1860
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
Conversation
I am using the following script to compare diff #
gt_tbl <- mtcars[1:2, 1:2] |>
gt::gt() |>
gt::cols_label(mpg = gt::md("**MPG**")) |>
gt::tab_footnote(
gt::md("_Adding footnote_"),
locations = gt::cells_column_labels(columns = gt::everything())
)
# inside Quarto
html_code_quarto <- withr::with_envvar(c("QUARTO_BIN_PATH" = "true"), gt:::render_as_html(gt_tbl))
# out of Quarto
html_code <- withr::with_envvar(c("QUARTO_BIN_PATH" = ""), gt:::render_as_html(gt_tbl))
waldo::compare(html_code, html_code_quarto, x_arg = "html", y_arg = "quarto")
html_file <- withr::local_tempfile(lines = html_code, pattern = "html")
quarto_file <- withr::local_tempfile(lines = html_code_quarto, pattern = "quarto")
diffviewer::visual_diff(
html_file,
quarto_file
) The diff seems good! i.e. spans are replaced by their base64 encoding equivalent. The following Qmd doc renders well too ---
title: "Test"
format: html
---
```{r}
#| echo: false
#| message: false
devtools::load_all()
exibble %>%
dplyr::select(num, char, fctr) %>%
dplyr::slice_head(n = 5) %>%
gt() %>%
fmt_markdown(num) %>%
tab_footnote(
md("Problem because num row 1 is fmt_markdown() + also the footnote is wrapped in md."),
locations = cells_body("num", 1)
) %>%
tab_footnote(
"A problem because fctr is labelled with md",
locations = cells_column_labels("fctr")
) %>%
tab_footnote(
"Not a problem",
locations = cells_column_labels("char")
) %>%
cols_label(fctr = md("**Factor**")) %>%
tab_header(md("**Title**")) %>%
tab_spanner(md("**Problem**"), c(2, 3))
``` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
non_na_text, | ||
non_na_text_processed, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the bad / unnecessary change and it is reverted in #1958
Summary
It seems that using a span instead of div seems to work!!
Sorry about the noise.
I also think it is not necessary to keep the gt_from_md class?#1605 (comment)
Related GitHub Issues and PRs
Fixes #1773
Checklist
testthat
unit tests totests/testthat
for any new functionality.