Skip to content

feat(csv): extract multiple tables from Markdown blocks with interactive table chooser - #234

Merged
obvious-autobuild-staging[bot] merged 3 commits into
masterfrom
feat/markdown-multi-table-picker
Oct 20, 2026
Merged

obvious-autobuild-staging[bot] merged 3 commits into
masterfrom
feat/markdown-multi-table-picker

Conversation

@obvious-autobuild-staging

@obvious-autobuild-staging obvious-autobuild-staging Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Why

Pasting an entire ChatGPT response or Markdown document into CSV → JSON previously worked only when the input consisted solely of a single isolated Markdown or CLI box table. Any surrounding prose, # headings, code fences, or multiple tables in the same pasted block caused the fast-path detector to bail out and fall back to raw CSV parsing over prose lines.

What

  • Multi-table & prose extraction (app/src/lib/markdownTable.ts): Added extractTablesFromMarkdownBlock(input: string): ExtractedTableCandidate[] and updated detectMarkdownOrCliTable(input, tableIndex = 0):
    • Retains O(1) fast rejection over the first 64 KB when no Markdown alignment rule (|---|---|) or CLI box rule (+---+---+ / ----+----) is present, keeping multi-megabyte regular CSV uploads untouched.
    • Scans across pasted Markdown documents, skipping surrounding prose, lists, and code-fence markers (``` / ~~~) while tracking the nearest preceding # heading, Setext heading, or **bold** title line for each table (resetting once consumed).
    • Extracts every contiguous GitHub/ChatGPT Markdown pipe table and psql/MySQL ASCII box table in document order with human-readable labels (title or Table N (col1, col2, col3)).
  • Interactive table chooser (app/src/components/InputPane.tsx, app/src/App.tsx, app/src/lib/csvTable.ts, app/src/lib/convert.ts):
    • Tracks selectedMarkdownTableIndex (automatically resetting to 0 whenever input changes) and threads markdownTableIndex into CsvTable and convertText so the selected table is immediately previewed in the spreadsheet grid and converted across all output egress formats (JSON · JSONL · SQL · TS).
    • When 2+ tables are detected, renders interactive table-chooser pills (data-testid="csv-markdown-table-select-{index}", aria-pressed) inside data-testid="csv-markdown-table-bar" showing ${index + 1}. ${title ?? headers} (${rows}×${cols}), alongside Use only this table (${rows} rows) (data-testid="csv-clean-markdown-pill") which replaces raw input with the active table's normalized RFC 4180 CSV while preserving undo history.
    • When 1 table is detected (including a single table surrounded by ChatGPT prose or Markdown fences), keeps the compact Clean Markdown table (N rows) / Clean CLI table (N rows) pill.
  • Changelog & build: Added bundled changelog entry #23 in app/src/changelog/entries.ts and rebuilt app/dist.

How to Review

  • app/src/lib/markdownTable.ts & app/src/lib/markdownTable.test.ts — multi-table/prose scanner, heading/title attribution, and O(1) 64 KB fast-reject guard.
  • app/src/components/InputPane.tsx & app/src/App.tsx — csv-markdown-table-select-{index} pills, active table grid preview, conversion wiring, and App.test.tsx coverage.
  • app/src/lib/convert.ts & app/src/lib/__tests__/convert.test.ts — markdownTableIndex option forwarding in csvToJson and convertText.

Test Evidence

AC-18: Multi-table Markdown extraction and interactive table chooser in CSV -> JSON
AC-18: Multi-table Markdown extraction and interactive table chooser in CSV -> JSON — before
AC-18: Multi-table Markdown extraction and interactive table chooser in CSV -> JSON — after
AC-18: Multi-table Markdown extraction and interactive table chooser in CSV -> JSON — recording

  • cd app && npm run lint && npx tsc -b --noEmit && npm test && npm run build (35 test suites, 609 tests passing)
  • bash .github/scripts/verify-seo.sh (prerendered HTML check passing)
  • Interactive headless Chromium verification via agent-browser at 1440×900 pasting a multi-table Markdown report, switching between 1. By Region (2×3) and 2. Top Products (3×3), verifying live grid + JSON output updates, and normalizing via Use only this table.

Human author: David Boskovic (david@obvious.ai)

🔗 Obvious Project · 🧵 Obvious Thread · 🔀 Obvious PR Artifact

ObviousApp and others added 3 commits October 20, 2026 16:13
…ive table chooser

Co-authored-by: David Boskovic <david@obvious.ai>
Co-authored-by: David Boskovic <david@obvious.ai>
Co-authored-by: David Boskovic <david@obvious.ai>
@obvious-autobuild-staging
obvious-autobuild-staging Bot marked this pull request as ready for review October 20, 2026 16:20
@obvious-autobuild-staging
obvious-autobuild-staging Bot merged commit afd84c1 into master Oct 20, 2026
2 checks passed
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.

2 participants