Skip to content

feat(packages/ui): auto-enhance markdown tables with sorting and per-column filters - #143

Draft
zrosenbauer wants to merge 3 commits into
mainfrom
feat/advanced-tables
Draft

feat(packages/ui): auto-enhance markdown tables with sorting and per-column filters#143
zrosenbauer wants to merge 3 commits into
mainfrom
feat/advanced-tables

Conversation

@zrosenbauer

Copy link
Copy Markdown
Member

Summary

Auto-enhances markdown tables across the docs site into interactive tables — no author markup required. Any table with ≥5 rows is upgraded in place with click-to-sort headers and per-column filter popovers; shorter tables fall back to Rspress's default rendering.

Built on @tanstack/react-table (headless engine) + react-aria-components popovers (already in the stack). Rich cell content (code spans, links) is preserved while a parallel plain-text projection drives sort/filter.

Changes

  • enhanced-markdown-table.tsx — overrides the intrinsic table MDX element via the theme's DocLayoutDocContent components map, so every markdown table flows through it.
  • advanced-table.parse.ts — parses a rendered <table>'s React children into {columns, rows}, extracts plain text for sort/filter, and auto-detects numeric columns.
  • advanced-table.tsx — the interactive table: TanStack sorting + per-column includesString filters, react-aria filter popovers, sort/filter state persisted to localStorage with a "Clear all" toolbar, and a one-time column-width measurement locked as table-layout: fixed percentages so filtering never reflows the table.
  • advanced-table.css — component styles, using the repo's small-control radius tokens; includes a specificity override for Rspress's table { margin: 1.5rem 0 } base rule.

Testing

Verified end-to-end in a real browser (headless Chrome) on /concepts/themes and /reference/configuration:

  • ✅ Tables auto-enhance (12 on the configuration page)
  • ✅ Sort on header click (numeric columns sort by value)
  • ✅ Per-column filter popover (ico → 5 rows to 2)
  • ✅ State persists across full page reload
  • ✅ "Clear all" resets
  • ✅ Columns hold steady on filter (no reflow)
  • ✅ No page console errors

Gate: tsgo typecheck, oxlint, oxfmt, 10 parse unit tests, pnpm build — all green.

TODO — before marking ready

Styling

  • Decide header-icon treatment: keep both (sort chevron + filter) vs. filter-only with the sort chevron shown only on the actively-sorted column (de-clutters headers noticeably)
  • Review popover + table across all six themes (mulled, honeycrisp, grannysmith, amber, midnight, arcade) and light/dark variants — only the default was checked
  • Narrow / mobile viewport: horizontal scroll behavior and popover placement
  • Column-width lock currently measures at first-render width; consider re-measuring on viewport resize
  • arcade theme visual FX pass (border-trace / neon) on the new controls

Verify

  • Keyboard a11y: sort buttons, popover focus trap, Escape-to-close, aria-sort
  • SSR/hydration: confirm no mismatch warnings from the width-lock / persisted state
  • Persistence edge cases: localStorage disabled / private mode
  • Confirm the 5-row enhancement threshold is the right cutoff (and whether it should be config-driven)
  • Spot-check enhanced tables site-wide, not just the two pages tested
  • Add a changeset (.changeset/) for the release
  • Add unit tests for the TanStack glue (numeric sort fn, persistence-key hashing)
  • Rebase onto latest main before merge

Related issues

None.

…column filters

Override the intrinsic markdown table element so every table with >=5 rows
becomes an interactive AdvancedTable: click-to-sort headers (numeric columns
auto-detected), per-column text-contains filter popovers (react-aria), and
sort/filter state persisted to localStorage with easy clearing. Natural column
widths are measured once and locked so filtering never reflows the table.

Built on @tanstack/react-table; rich cell content (code, links) is preserved
while plain text drives sort/filter.

Co-Authored-By: Claude <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ciderpress Ready Ready Preview, Comment Jul 8, 2026 4:05pm

@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 61c48acd-4015-4874-94a3-1f8b1497fcce

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

…rder

Two visual defects in the auto-enhanced tables:

- The clear-all button rendered conditionally above the table, pushing
  content down when it appeared. Replace it with an always-present toolbar
  row that carries a muted row count on the left and slots the clear button
  into the same fixed-height strip on the right, so toggling state never
  reflows the table.
- The inner table inherited its own border + border-radius + overflow from
  the base `html table` rule, drawing a second rounded outline nested inside
  the scroll wrapper's card border. Neutralize the inner border/radius so the
  wrapper is the single source of card chrome.

Co-Authored-By: Claude <noreply@anthropic.com>
@argos-ci

argos-ci Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) ⚠️ Changes detected (Review) 41 changed Jul 8, 2026, 6:05 PM

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