Skip to content

Replace gt with lt for AE table rendering - #266

Draft
yihui wants to merge 2 commits into
mainfrom
replace-gt-with-lt
Draft

yihui wants to merge 2 commits into
mainfrom
replace-gt-with-lt

Conversation

@yihui

@yihui yihui commented Oct 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Render AE summary and specific tables with the lightweight lt package instead of gt, dropping ~54 recursive dependencies (lt depends only on xfun).

Changes

  • gt_ae_summary() and gt_ae_specific() keep their exported names and signatures but now return an lt_tbl (previously a gt_tbl). This return-contract change is unavoidable when swapping the rendering backend.
  • Translated the gt grammar to lt:
    • gt() -> lt() (with auto_format = FALSE to preserve the pre-formatted cell strings)
    • tab_spanner() -> lt_spanner()
    • cols_label() -> lt_label()
    • tab_header(title = md(...)) -> lt_header(title = I(...)) (lines joined with <br>)
    • sub_missing(missing_text = "") -> lt_sub(missing = "")
    • fmt_markdown() on the name column -> lt_html() to render the generated <sup> tags as raw HTML
    • tab_style(cell_text(weight = "bold")) -> lt_style(bold = TRUE)
    • tab_style(cell_text(indent = px(10))) -> lt_indent()
    • tab_source_note() -> lt_note() (one note per footnote/source line)
  • Factored the duplicated {^...} -> <sup> helper out of both files into a single internal convert_caret_sup() in R/utility.R.
  • DESCRIPTION: removed gt from Imports, added lt, and added Remotes: yihui/lt (lt is not on CRAN; no version pin).
  • Updated the developer tests to assert the lt_tbl class and check the rendered HTML via format().

Decisions / notes

  • Names kept to avoid breaking the API: exported functions stay gt_ae_summary() / gt_ae_specific(), and the files stay R/gt_ae_*.R. Minimal churn.
  • No lt S3 method or generic re-export is needed: these functions call lt::lt() directly on a data frame.
  • Vignette prose still says "gt format" in a few spots; the code paths now produce lt tables and render fine via lt's knit_print method.

Verification

devtools::load_all() + the two affected test files pass:

developer-testing-gt_ae_specific: ......
developer-testing-gt_ae_summary: .

🤖 Generated with Claude Code

yihui and others added 2 commits October 16, 2026 13:52
Render AE summary and specific tables with the lightweight `lt`
package instead of `gt`, dropping ~54 recursive dependencies.

- `gt_ae_summary()` / `gt_ae_specific()` keep their exported names and
  signatures but now return an `lt_tbl` (previously a `gt_tbl`).
- Map the gt grammar to lt: `gt()`->`lt()`, `tab_spanner()`->`lt_spanner()`,
  `cols_label()`->`lt_label()`, `tab_header()`->`lt_header()`,
  `sub_missing()`->`lt_sub()`, `fmt_markdown()`+raw HTML name column via
  `lt_html()`, `tab_style(weight=bold)`->`lt_style(bold=)`,
  `tab_style(indent)`->`lt_indent()`, and `tab_source_note()`->`lt_note()`.
- Factor the duplicated `{^...}` superscript helper into a single
  internal `convert_caret_sup()` in utility.R.
- Swap `gt` for `lt` in DESCRIPTION Imports and add `Remotes: yihui/lt`
  (lt is not on CRAN).
- Update the developer tests to assert the `lt_tbl` class and check the
  rendered HTML via `format()`.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Code <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant