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

Add gt-processed md to content of span #1455

Merged
merged 4 commits into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,8 @@

* Fixed a LaTeX bug where some characters following a `\midrule` would corrupt the table (#145, #391, #1107, #1182). (#1390)

* Provided a rendering fallback for HTML tables rendered in Quarto where the combination of `fmt_markdown()` and `tab_options(quarto.disable_processing = TRUE)` would incorrectly result in empty cells. (#1455)

* A issue associated with a lack of HTML formatting within interactive tables has been fixed (#1299, #1370, #1384, #1443). (#1388)

* Many user-facing error messages have been enhanced using the latest features from the **cli** package. (#1337, thanks @olivroy!)
Expand Down
20 changes: 18 additions & 2 deletions R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -757,8 +757,24 @@ md_to_html <- function(x, md_engine) {

non_na_x <- x[!is.na(x)]

non_na_x <- tidy_gsub(non_na_x, "^", "<span data-qmd=\"")
non_na_x <- tidy_gsub(non_na_x, "$", "\"></span>")
non_na_x_processed <-
vapply(
as.character(x[!is.na(x)]),
FUN.VALUE = character(1),
USE.NAMES = FALSE,
FUN = function(x) {
md_engine_fn[[1]](text = x)
}
)

non_na_x <- tidy_gsub(non_na_x, "^", "<div data-qmd=\"")
non_na_x <- tidy_gsub(non_na_x, "$", "\">")

non_na_x <-
paste0(
non_na_x, "<div class='gt_from_md'>",
non_na_x_processed, "</div></div>"
)

#nocov end
}
Expand Down
Loading