Skip to content

Commit dbfba01

Browse files
authored
Merge pull request #12747 from quarto-dev/bugfix/quarto-table-postprocess
Bugfix/quarto table postprocess
2 parents 724c175 + 0765d57 commit dbfba01

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

news/changelog-1.8.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ All changes included in 1.8:
1515
- ([#10983](https://github.com/quarto-dev/quarto-cli/issues/10983)): Fix spacing inconsistency between paras and first section headings.
1616
- ([#12259](https://github.com/quarto-dev/quarto-cli/issues/12259)): Fix conflict between `html-math-method: katex` and crossref popups (author: @benkeks).
1717
- ([#12734](https://github.com/quarto-dev/quarto-cli/issues/12734)): `highlight-style` now correctly supports setting a different `light` and `dark`.
18+
- ([#12747](https://github.com/quarto-dev/quarto-cli/issues/12747)): Ensure `th` elements are properly restored when Quarto's HTML table processing is happening.
1819

1920
### `revealjs`
2021

src/format/html/format-html.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -817,15 +817,15 @@ function htmlFormatPostprocessor(
817817

818818
// Process tables to restore th-vs-td markers
819819
const tables = doc.querySelectorAll(
820-
'table[data-quarto-postprocess-tables="true"]',
820+
'table[data-quarto-postprocess="true"]',
821821
);
822-
823822
for (let i = 0; i < tables.length; ++i) {
824823
const table = tables[i] as Element;
825-
if (table.getAttribute("data-quarto-disable-processing")) {
824+
if (table.getAttribute("data-quarto-disable-processing") === "true") {
826825
continue;
827826
}
828-
table.removeAttribute("data-quarto-postprocess-tables");
827+
table.removeAttribute("data-quarto-postprocess");
828+
table.removeAttribute("data-quarto-disable-processing");
829829
table.querySelectorAll("tr").forEach((tr) => {
830830
const { children } = tr as Element;
831831
for (let j = 0; j < children.length; ++j) {
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
title: hello
3+
_quarto:
4+
tests:
5+
html:
6+
ensureHtmlElements:
7+
- []
8+
- ['td[data-quarto-table-cell-role="th"]']
9+
---
10+
11+
```{r}
12+
library(gt)
13+
library(dplyr)
14+
15+
exibble %>%
16+
dplyr::group_by(group) %>%
17+
gt(groupname_col = "date")
18+
```

0 commit comments

Comments
 (0)