Skip to content

feat(csv): support Markdown, ChatGPT, and psql/MySQL box table paste (AC-14) - #231

Merged
obvious-autobuild-staging[bot] merged 1 commit into
masterfrom
feat/markdown-table-paste
Oct 20, 2026
Merged

obvious-autobuild-staging[bot] merged 1 commit into
masterfrom
feat/markdown-table-paste

Conversation

@obvious-autobuild-staging

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

Copy link
Copy Markdown
Contributor

Why

Developers and analysts frequently copy Markdown pipe tables out of GitHub PRs, docs, or ChatGPT responses (| name | score |\n| --- | ---: |\n| Ada | 42 |) or copy ASCII box tables straight from psql and MySQL terminals (id | city\n----+------\n 1 | Rome\n(1 row)). Pasting either format into CSV -> JSON previously treated the | --- | --- | or ----+---- separator rule as a data row, produced empty leading and trailing columns from outer border pipes, and included (N rows) CLI footers as malformed rows.

What

  • Markdown & CLI Box Table Detector/Normalizer (app/src/lib/markdownTable.ts):
    • Added detectMarkdownOrCliTable(input: string): DetectedTablePaste | null supporting both GitHub/ChatGPT Markdown pipe tables (header row + | --- | :---: | alignment separator + data rows, unescaping \| -> |, trimming cell padding, and RFC 4180-quoting cells) and psql/MySQL ASCII box tables (+---+---+ framed box tables and col1 | col2 + ----+---- border tables with optional (N rows) footers).
    • Returns null for standard CSV, TSV, JSON, or plain pipe-separated CSV that has no Markdown or CLI separator rule line.
  • Automatic Table Preview & Conversion Normalization (app/src/lib/csvTable.ts, app/src/lib/convert.ts, app/src/components/CsvTable.tsx):
    • When separator is "auto" (or default), parseCsvTable and convertText (csv2json) automatically normalize detected Markdown or CLI box tables so the input grid and JSON output render clean columns and rows immediately on paste.
  • Contextual One-Click Cleanup Pill (app/src/components/InputPane.tsx):
    • Renders data-testid="csv-markdown-table-bar" and data-testid="csv-clean-markdown-pill" (Clean Markdown table (N rows) or Clean CLI table (N rows)) above the CSV table when a Markdown or CLI box table is pasted. Clicking rewrites raw input into canonical comma-separated CSV and pushes the original Markdown/CLI table onto the undo stack (Mod+Z).
  • Changelog & Tests:
    • Added bundled changelog entry #19 in app/src/changelog/entries.ts.
    • Added unit and component tests in app/src/lib/markdownTable.test.ts, app/src/lib/__tests__/convert.test.ts, and app/src/App.test.tsx.

How to Review

  • app/src/lib/markdownTable.ts and app/src/lib/markdownTable.test.ts — pure detection and normalization logic for Markdown pipe tables and psql/MySQL ASCII box tables.
  • app/src/lib/csvTable.ts and app/src/lib/convert.ts — auto-normalization hook when separator is "auto".
  • app/src/components/InputPane.tsx and app/src/App.test.tsx — contextual Clean Markdown table / Clean CLI table pill and undo integration.

Verification

  • cd app && npm run lint && npx tsc -b --noEmit && npm test && npm run build (35 test suites, 579 tests passing)
  • bash .github/scripts/verify-seo.sh (passed, 45,103 bytes prerendered HTML)

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

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

Test Evidence

AC-14: Paste GitHub/ChatGPT Markdown and psql/MySQL CLI box tables with auto-normalization and one-click Clean table pill
AC-14: Paste GitHub/ChatGPT Markdown and psql/MySQL CLI box tables with auto-normalization and one-click Clean table pill — before
AC-14: Paste GitHub/ChatGPT Markdown and psql/MySQL CLI box tables with auto-normalization and one-click Clean table pill — after

@obvious-autobuild-staging
obvious-autobuild-staging Bot marked this pull request as ready for review October 20, 2026 02:41
…(AC-14)

- Add detectMarkdownOrCliTable in app/src/lib/markdownTable.ts to detect and normalize GitHub/ChatGPT Markdown pipe tables and psql/MySQL ASCII box tables into RFC 4180 CSV.
- Auto-normalize detected Markdown/CLI tables inside parseCsvTable and convertText/csvToJson (when separator is auto) so pasted tables immediately render clean columns and rows in CsvTable and JSON output without divider rows or empty outer pipe columns.
- Surface a contextual Clean Markdown table / Clean CLI table pill (data-testid="csv-clean-markdown-pill") in InputPane to rewrite raw input into canonical CSV in place while recording an undo snapshot.
- Add bundled changelog entry #21 and unit/component test coverage.

Co-authored-by: David Boskovic <david@obvious.ai>
@obvious-autobuild-staging
obvious-autobuild-staging Bot merged commit ad2e3d2 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