Skip to content

Replace lt_class() with lt_wrap() for arbitrary container attributes - #43

Merged
yihui merged 1 commit into
mainfrom
lt-wrap
Oct 10, 2026
Merged

yihui merged 1 commit into
mainfrom
lt-wrap

Conversation

@yihui

@yihui yihui commented Oct 10, 2026

Copy link
Copy Markdown
Owner

lt_wrap(x, ...) sets any HTML attributes on the <div class="lt-wrap"> that wraps the table — class, style, id, data-*, etc. class is appended to the base lt-wrap (and accumulates across repeated calls); every other attribute is emitted as-is, HTML-escaped. Set once at the single wrap-emission point in buildHtml, so it covers both the runtime and the static (node) bake.

Supersedes lt_class() (added this dev cycle, never released), which only set the class. lt_wrap(class = ...) is the drop-in replacement; the new verb also enables, e.g., giving the container a fixed width (lt_wrap(x, style = "width:800px")) with the existing .lt-wrap { overflow-x:auto } handling the scroll.

Changes:

  • New lt_wrap(); lt_class() removed (docs/NAMESPACE/README/example updated).
  • inst/www/lt.js: wrap div emits spec.wrap attributes via the existing attr/esc helpers.
  • Tests: unit assert for class accumulation (test-tab.R); browser/node assert that attributes land on .lt-wrap, class is appended, and values are escaped (test-render-js.R).
  • Version bumped to 0.4.43.

Default output is byte-identical when lt_wrap() is unused (test-snap.md unchanged).

🤖 Generated with Claude Code

lt_wrap(x, ...) sets any HTML attributes on the <div class="lt-wrap">
container (class, style, id, data-*, ...). class is appended to the base
lt-wrap and accumulates across calls; other attributes are emitted as-is,
escaped. Supersedes the dev-only, unreleased lt_class(), which set only
the class. Enables scoping CSS to one table or giving it a fixed width.

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

Copy link
Copy Markdown
Contributor

🚀 Site preview: https://lt-pr-43.surge.sh

Updates on every push; removed when this PR closes.

@yihui
yihui merged commit 2c41a92 into main Oct 10, 2026
10 checks passed
@yihui
yihui deleted the lt-wrap branch October 10, 2026 04:21
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