Skip to content

Commit 23317d5

Browse files
authored
Merge branch 'master' into incorrect-stub
2 parents 6232e60 + 37a25ab commit 23317d5

File tree

280 files changed

+54496
-5022
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

280 files changed

+54496
-5022
lines changed

.Rbuildignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,9 @@ tests/testthat/test-location_cells.R
123123

124124
tests/testthat/test-opts.R
125125

126+
tests/testthat/test-quarto.R
127+
tests/testthat/_snaps/quarto.md
128+
126129
tests/testthat/test-removal_functions.R
127130
tests/testthat/_snaps/removal_functions.md
128131

.github/CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ If you believe you found a bug, create a minimal [reprex](https://reprex.tidyver
1010

1111
A great way to help is by simply answering questions. It's amazing how a little conversation could lead to better insights on a problem. Don't quite know the answer? That's okay too. We're all in this together.
1212

13-
Where might you answer user questions? Some of the forums for Q&A on **gt** include the [Posit community](https://community.rstudio.com), on Twitter (a good search term is `gt #rstats`), and on [Stack Overflow](https://stackoverflow.com). Good etiquette is key during these interactions: be a good person to all who ask questions.
13+
Where might you answer user questions? Some of the forums for Q&A on **gt** include the [Posit community](https://forum.posit.co), on Bluesky (a good search term is `gt #rstats`), and on [Stack Overflow](https://stackoverflow.com). Good etiquette is key during these interactions: be a good person to all who ask questions.
1414

1515
### Making Pull Requests
1616

.github/workflows/test-coverage.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525

2626
- uses: r-lib/actions/setup-r-dependencies@v2
2727
with:
28-
extra-packages: any::covr, any::xml2
28+
extra-packages: r-lib/covr, any::xml2
2929
needs: coverage
3030

3131
- name: Test coverage

DESCRIPTION

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Type: Package
22
Package: gt
33
Title: Easily Create Presentation-Ready Display Tables
4-
Version: 0.11.0.9000
4+
Version: 0.11.1.9000
55
Authors@R: c(
66
person("Richard", "Iannone", , "rich@posit.co", role = c("aut", "cre"),
77
comment = c(ORCID = "0000-0003-3925-190X")),
@@ -35,25 +35,24 @@ Imports:
3535
base64enc (>= 0.1-3),
3636
bigD (>= 0.2),
3737
bitops (>= 1.0-7),
38-
cli (>= 3.6.0),
39-
commonmark (>= 1.8.1),
40-
dplyr (>= 1.1.0),
41-
fs (>= 1.6.1),
42-
glue (>= 1.6.2),
43-
htmltools (>= 0.5.4),
44-
htmlwidgets (>= 1.6.1),
38+
cli (>= 3.6.3),
39+
commonmark (>= 1.9.1),
40+
dplyr (>= 1.1.4),
41+
fs (>= 1.6.4),
42+
glue (>= 1.8.0),
43+
htmltools (>= 0.5.8.1),
44+
htmlwidgets (>= 1.6.4),
4545
juicyjuice (>= 0.1.0),
46-
magrittr (>= 2.0.2),
47-
markdown (>= 1.5),
48-
reactable (>= 0.4.3),
49-
rlang (>= 1.1.0),
50-
sass (>= 0.4.5),
51-
scales (>= 1.2.1),
52-
tidyselect (>= 1.2.0),
46+
magrittr (>= 2.0.3),
47+
markdown (>= 1.13),
48+
reactable (>= 0.4.4),
49+
rlang (>= 1.1.4),
50+
sass (>= 0.4.9),
51+
scales (>= 1.3.0),
52+
tidyselect (>= 1.2.1),
5353
vctrs,
54-
xml2 (>= 1.3.3)
54+
xml2 (>= 1.3.6)
5555
Suggests:
56-
digest (>= 0.6.31),
5756
fontawesome (>= 0.5.2),
5857
ggplot2,
5958
grid,
@@ -67,9 +66,9 @@ Suggests:
6766
rmarkdown (>= 2.20),
6867
rsvg,
6968
rvest,
70-
shiny (>= 1.7.4),
69+
shiny (>= 1.9.1),
7170
testthat (>= 3.1.9),
72-
tidyr,
71+
tidyr (>= 1.0.0),
7372
webshot2 (>= 0.1.0),
7473
withr
7574
Config/Needs/coverage: officer

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2018-2024
1+
YEAR: 2018-2025
22
COPYRIGHT HOLDER: Posit Software, PBC

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2018-2024 Posit Software, PBC
3+
Copyright (c) 2018-2025 Posit Software, PBC
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

NAMESPACE

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# Generated by roxygen2: do not edit by hand
22

3+
S3method("$",gt_option)
34
S3method(add_text_style,character)
45
S3method(add_text_style,shiny.tag)
56
S3method(as.data.frame,gt_tbl)
@@ -156,6 +157,7 @@ export(gt_latex_dependencies)
156157
export(gt_output)
157158
export(gt_preview)
158159
export(gt_split)
160+
export(gt_update_select)
159161
export(gtsave)
160162
export(html)
161163
export(info_currencies)

NEWS.md

Lines changed: 67 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,100 @@
11
# gt (development version)
22

3-
## New features
3+
* Fixed an issue where `fmt_markdown()` could create strange output in Quarto (html and Typst formats) (@olivroy, #1957, [quarto-dev/quarto-cli#11932](https://github.com/quarto-dev/quarto-cli/issues/11932), [quarto-dev/quarto-cli#11610](https://github.com/quarto-dev/quarto-cli/issues/11610)).
4+
5+
* The default table position in LaTeX is now "t" instead of "!t" (@AaronGullickson, #1935).
6+
7+
* Fixed an issue where cross-references would fail in bookdown::html_document2 (@olivroy, #1948)
8+
9+
* Significantly faster rendering of certain large tables, by optimizing the internal `rownum_translation()` utility. (@magnusdv, #1924)
10+
11+
* Interactive tables can support selection through the `ihtml.selection_mode` option. (@jonthegeek, #1909)
12+
13+
* Tables embedded in Shiny apps with `gt_output()` and `render_gt()` with `ihtml.selection_mode` enabled also act as inputs, reporting the row numbers that are selected (#354, #1368). (@jonthegeek, #1909)
14+
15+
* Improved width calculations in `as_gtable()` (@teunbrand, #1923)
16+
17+
* `gt(row_group_as_column = TRUE)` now works if multiple groups are supplied (@olivroy, #1552).
18+
19+
* `tab_row_group()` now works if `row_group_as_column = TRUE` (@olivroy, #1552).
20+
21+
# gt 0.11.1
22+
23+
## Breaking changes
24+
25+
* The `extract_body()` function now, by default, will not display columns that have been hidden (e.g., by `cols_hide()` or `cols_merge*()`); the previous behavior can be restored by using `incl_hidden_cols = TRUE`.
26+
27+
## Improvements to the LaTeX output format
28+
29+
* PDF output now defaults to a full-width floating environment using `tabular*`. Float position can be controlled by the `latex.tbl.pos` argument in `tab_options`. Quarto users can alternatively use the `tbl-pos` argument to control positioning. To use a `longtable` environment instead, use `tab_option(latex.use_longtable = TRUE)`. (@AronGullickson, #1588)
30+
31+
* Creating a caption with `tab_caption()` will now be preserved in LaTeX output with `as_latex()`. Cross-referencing a table using the internal cross-referencing system of **bookdown** is now enabled for PDF and HTML outputs (for HTML, set `options("htmltools.preserve.raw" = FALSE)`). Quarto users should use the `tbl-cap` and `label` cell options. (@nielsbock, #1800)
432

5-
* PDF output now defaults to a full-width floating environment using `tabular*` (@AronGullickson, #1588). Float position can be controlled by the `latex.tbl.pos` argument in `tab_options`. Quarto users can alternatively use the `tbl-pos` argument to control positioning. To use a `longtable` environment instead, use `tab_option(latex.use_longtable = TRUE)`.
33+
* Improved the centering of the stubhead label in Latex when `row_group_as_column = TRUE` and the width of the row name column is specified. (@kbrevoort, #1804)
34+
35+
* LaTeX now correctly renders if text size is changed (#1885). (@olivroy, #1899)
36+
37+
* Fixed a bug that caused an error in LaTeX when (1) `row_group_as_column = TRUE`, (2) the row groups were specified using `tab_row_group()`, and (3) the user specified a width for the row label column. (@kbrevoort, #1804)
38+
39+
* Fixed an issue where column widths weren't set properly using `col_widths()` for LaTeX output (#1837). (@snhansen, #1867)
640

741
## Interactive table support
842

943
* Interactive tables will show no border if `opt_table_lines(extent = "none")` is specified (#1307).
1044

11-
* Interactive tables now respect more styling options.
12-
13-
* `column_labels.background.color`, `row_group.background.color`, `row_group.font.weight`, `table_body.hlines.style`,
14-
`table.font.weight`, `table.font.size`, `stub.font.weight` (#1693).
45+
* Interactive tables now respect more styling options, namely: `column_labels.background.color`, `row_group.background.color`, `row_group.font.weight`, `table_body.hlines.style`, `table.font.weight`, `table.font.size`, and `stub.font.weight`. (#1693)
1546

16-
* `opt_interactive()` now works when columns are merged with `cols_merge()` (@olivroy, #1785).
47+
* `opt_interactive()` now works when columns are merged with `cols_merge()`. (@olivroy, #1785)
1748

18-
* `opt_interactive()` now works when columns are substituted with `sub_*()` (@olivroy, #1759).
49+
* `opt_interactive()` now works when columns are substituted with `sub_*()`. (@olivroy, #1759)
1950

2051
* More support for `cells_stubhead()` styling and footnotes in interactive tables.
2152

22-
## Bug fixes
53+
## Minor improvements and bug fixes
2354

24-
* Improved error messages for the `text_transform()` function if `locations` couldn't be resolved. (@olivroy, #1774)
55+
* New arguments have been added to `extract_body()` to better control which columns will be present in the returned data (#1875). (#1889)
2556

26-
* `tab_row_group()` gives a more precise error message when `rows` can't be resolved correctly (#1535). (@olivroy, #1770)
57+
* The `locale` argument of `gt()` now defaults to `getOption("gt.locale")` if set. (#1894)
2758

28-
* Fixed an issue where `md("")` would fail in Quarto. (@olivroy, #1769)
59+
* The optional argument `levels` was added to `cells_column_spanners()` to constrain targeting of column spanners by their level. (@obsaditelnost, #1858)
2960

30-
* Fixed a bug in using `pct()` column widths with `as_gtable()` (@teunbrand, #1771)
61+
* Fixed a bug in using `pct()` column widths with `as_gtable()` (#1771). (@teunbrand, #1776)
3162

32-
* Fixed a bug where `gt(row_group_as_column = TRUE)` would create the wrong layout with `as_gtable()` when all groups are unique (@olivroy, #1803).
63+
* Fixed a bug where `gt(row_group_as_column = TRUE)` would create the wrong layout with `as_gtable()` when all groups are unique. (@olivroy, #1803)
3364

34-
* grid output has been improved. Namely, showing currency symbols now works (@olivroy, #1788).
65+
* Showing currency symbols in grid output now works. (@olivroy, #1788)
3566

36-
* `data_color()` no longer errors when a tidyselect selection is empty (like `fmt_*()` functions) (@olivroy, #1665).
67+
* `data_color()` no longer errors when a tidyselect selection is empty (like `fmt_*()` functions) (#1665). (@olivroy, #1795)
3768

38-
* Fixed a bugs that caused an error in Latex when `row_group_as_column = TRUE`, the row groups were specified using the `tab_row_group`, and the user specified a width for the row name columns (@kbrevoort, #1804).
69+
* Fixed an issue when using `text_case_match(.replace = "all", .locations = cells_column_spanners())`. (@olivroy, #1823)
3970

40-
* Improve the centering of the stubhead label in Latex when `row_group_as_column = TRUE` and the width of the row name column is specified (@kbrevoort, #1804).
71+
* Improved performance during footnote rendering. (@olivroy, #1818)
4172

42-
* Fixed an issue with `text_case_match(.replace = "all", .locations = cells_column_spanners())` (@olivroy, #1823).
73+
* Improved footnote rendering in Quarto with `fmt_markdown()` (#1773). (@olivroy, #1860)
4374

44-
* Performance improvement for footnote rendering (@olivroy, #1818).
75+
* Fixed an issue where `md("")` would fail in Quarto (#1769). (@olivroy, #1772)
4576

46-
* `tab_footnote()` now correctly adds footnote marks in the `cells_stub_summary()` and `cells_stub_grand_summary()` (@olivroy, #1832).
77+
* Fixed a bug where spanners didn't render correctly in Quarto (#1839). (#1856)
4778

48-
* Fixed an issue where `tab_spanner_delim()` would fail to resolve a duplicate id (@olivroy, #1821).
79+
* `vec_fmt_markdown()` works correctly inside Quarto again (#1840). (@olivroy, #1841)
4980

50-
* Fixed an issue with multiple `text_replace()` calls would produce bad result with `cells_column_labels()` (@olivroy, #1824).
81+
* Fixed an issue where `tab_spanner_delim()` would fail to resolve a duplicate ID value. (@olivroy, #1821)
5182

52-
* `tidyselect::where()`, `tidyselect::all_of()`, `tidyselect::any_of()` are now re-exported by gt.
83+
* Fixed an issue with multiple `text_replace()` calls would produce bad results with `cells_column_labels()`. (@olivroy, #1824)
5384

54-
* `vec_fmt_markdown()` works correctly inside Quarto again (@olivroy, #1840).
85+
* `cols_add()` works correctly in more cases. (#1893)
5586

56-
* `gt(row_group_as_column = TRUE)` now works if multiple groups are supplied (@olivroy, #1552).
87+
* `tab_footnote()` now correctly adds footnote marks in the `cells_stub_summary()` and `cells_stub_grand_summary()` locations (#1832). (@olivroy, #1833)
5788

58-
* `tab_row_group()` now works if `row_group_as_column = TRUE` (@olivroy, #1552).
89+
* `tidyselect::where()`, `tidyselect::all_of()`, and `tidyselect::any_of()` are now re-exported by gt. (#1830)
90+
91+
* Fixed an issue where `md()` and `fmt_markdown()` would render factors as their numeric levels rather than their text labels (#1882). (@rossellhayes, #1883)
92+
93+
* `vec_fmt_*()` (and incidentally `cols_nanoplot()`) should be faster now. (@olivroy, #1888, #1891, #1896, #1901)
94+
95+
* Improved error messages for the `text_transform()` function if `locations` couldn't be resolved. (@olivroy, #1774)
96+
97+
* `tab_row_group()` gives a more precise error message when `rows` can't be resolved correctly (#1535). (@olivroy, #1770)
5998

6099
# gt 0.11.0
61100

@@ -554,7 +593,7 @@
554593

555594
* Added the `opt_horizontal_padding()` and `opt_vertical_padding()` functions to easily expand or contract an HTML table in the horizontal and vertical directions (#868). (#882)
556595

557-
* There is now a `locale` argument in the `gt()` function. If set, formatter functions like `fmt_number()` will automatically use this global locale while formatting. There also remains the the option to override the global locale with any non-`NULL` value set for `locale` within a `fmt_*()` call (#682). (#866)
596+
* There is now a `locale` argument in the `gt()` function. If set, formatter functions like `fmt_number()` will automatically use this global locale while formatting. There also remains the option to override the global locale with any non-`NULL` value set for `locale` within a `fmt_*()` call (#682). (#866)
558597

559598
## Minor improvements and bug fixes
560599

R/as_data_frame.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515
# This file is part of the 'rstudio/gt' project.
1616
#
17-
# Copyright (c) 2018-2024 gt authors
17+
# Copyright (c) 2018-2025 gt authors
1818
#
1919
# For full copyright and license information, please look at
2020
# https://gt.rstudio.com/LICENSE.html

R/build_data.R

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#
1515
# This file is part of the 'rstudio/gt' project.
1616
#
17-
# Copyright (c) 2018-2024 gt authors
17+
# Copyright (c) 2018-2025 gt authors
1818
#
1919
# For full copyright and license information, please look at
2020
# https://gt.rstudio.com/LICENSE.html
@@ -40,7 +40,7 @@ build_data <- function(data, context) {
4040
# Reassemble the rows and columns of `body` in
4141
# the correct order
4242
data <- dt_body_build(data = data)
43-
data <- render_formats(data = data, context = context)
43+
data <- render_formats(data = data, skip_compat_check = FALSE, context = context)
4444
data <- render_substitutions(data = data, context = context)
4545
data <- migrate_unformatted_to_output(data = data, context = context)
4646
data <- perform_col_merge(data = data, context = context)
@@ -88,3 +88,16 @@ build_data <- function(data, context) {
8888

8989
data
9090
}
91+
92+
93+
# Faster implementation that avoids some operations
94+
# for vec_*() functions
95+
# only build the body correctly.
96+
build_data_body <- function(data, context) {
97+
98+
data <- dt_body_build(data = data)
99+
data <- render_formats(data = data, skip_compat_check = TRUE, context = context)
100+
data <- migrate_unformatted_to_output(data = data, context = context)
101+
102+
data
103+
}

0 commit comments

Comments
 (0)