Skip to content

Improve the stub so that it can be formatted #1038

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

Merged
merged 23 commits into from
Sep 6, 2022
Merged

Improve the stub so that it can be formatted #1038

merged 23 commits into from
Sep 6, 2022

Conversation

rich-iannone
Copy link
Member

@rich-iannone rich-iannone commented Sep 3, 2022

These changes make it possible to format the stub with fmt_*() functions. This also adds the stub() select helper function.

The following code uses the stub() helper in a few functions. Notably, fmt_markdown() now performs Markdown translation in a stub column, cols_align() now works on the stub column, and the width of the stub column is now easier to control with stub() on the LHS of ~.

library(gt)

dplyr::tibble(
  stub = c("*one*", "**two**", "three"),
  vals = 3:1
) %>%
  gt(rowname_col = "stub") %>%
  fmt_markdown(columns = stub()) %>%
  cols_align(
    align = "center",
    columns = everything()
  ) %>%
  cols_width(
    stub() ~ px(500),
    everything() ~ px(200)
  )

power-stub

Fixes: #747

@rich-iannone rich-iannone marked this pull request as ready for review September 6, 2022 03:35
@rich-iannone rich-iannone requested a review from cscheid September 6, 2022 14:41
Copy link
Member

@cscheid cscheid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@cscheid cscheid merged commit 1bf93cd into master Sep 6, 2022
@rich-iannone rich-iannone deleted the power-stub branch September 6, 2022 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce the stub() helper function to target the stub (for cols_width() and other targeting fns)
2 participants