Skip to content

Commit

Permalink
Merge pull request #1455 from rstudio/quarto-md-to-html-fix
Browse files Browse the repository at this point in the history
Add gt-processed md to content of span
  • Loading branch information
rich-iannone authored Oct 5, 2023
2 parents 4dab304 + 51615c1 commit 7c3a654
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
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

0 comments on commit 7c3a654

Please sign in to comment.