Parse and format tabular data as beautifully aligned markdown tables.
- Multiple input formats: Automatically detects and parses CSV, TSV, Markdown tables, and SQL dump output
- Smart width management: Fits tables within 100 characters (configurable)
- Intelligent table splitting: Splits wide tables across multiple tables when needed
- Key column detection: Repeats first column in split tables when it contains unique values
- Beautiful formatting: Pipes align vertically for easy reading in plain text
- Dual interface: Command-line (stdio) and REST API interfaces
- Rate limiting: Built-in API rate limiting for production use
- Empty column filtering: Automatically removes columns with only empty/whitespace values
- Browser version: Interactive web interface for formatting tables online
Try it online: https://macsplit.github.io/tabled/docs/
The browser version runs 100% client-side - no data is sent to any server. Perfect for formatting tables quickly without installing anything!
npm installPipe any tabular data into tabled:
# CSV input
cat data.csv | node src/index.js
# TSV input
cat data.tsv | node src/index.js
# Markdown table
cat table.md | node src/index.js
# SQL dump output
mysql -e "SELECT * FROM users" | node src/index.jsOr use input redirection:
node src/index.js < data.csvnpm link
tabled < data.csvStart the HTTP server:
npm run serverThe server listens on port 3000 by default (configurable via PORT environment variable):
PORT=8080 npm run serverPOST /format - Format tabular data as markdown table
Request formats:
- Plain text body:
curl -X POST http://localhost:3000/format \
-H "Content-Type: text/plain" \
-d "Name,Age,City
John,25,NYC
Jane,30,LA"- JSON body with
datafield:
curl -X POST http://localhost:3000/format \
-H "Content-Type: application/json" \
-d '{"data": "Product\tPrice\nLaptop\t999.99\nMouse\t29.99"}'- JSON body with
textfield:
curl -X POST http://localhost:3000/format \
-H "Content-Type: application/json" \
-d '{"text": "ID,Name\n1,Alice\n2,Bob"}'- File input:
curl -X POST http://localhost:3000/format \
-H "Content-Type: text/plain" \
--data-binary @data.csvQuery parameters:
maxWidth(optional): Maximum table width in characters (default: 100, minimum: 20)
curl -X POST "http://localhost:3000/format?maxWidth=80" \
-H "Content-Type: text/plain" \
--data-binary @data.csvGET /health - Health check endpoint
curl http://localhost:3000/health
# Response: {"status":"ok","service":"tabled"}The API implements rate limiting to prevent abuse:
- Limit: 100 requests per 15 minutes per IP address
- Rate limit information is returned in response headers
- Exceeding the limit returns HTTP 429 with error message
Name,Age,City,Country
John Smith,32,New York,USA
Jane Doe,28,London,UK| Name | Age | City | Country |
|------------|-----|----------|---------|
| John Smith | 32 | New York | USA |
| Jane Doe | 28 | London | UK |
When tables exceed 100 characters, they're automatically split:
| ID | Name | Email | Phone |
|----|------------|------------------|----------|
| 1 | John Smith | john@example.com | 555-0101 |
| 2 | Jane Doe | jane@example.com | 555-0102 |
| ID | City | State | Country |
|----|----------|-------|---------|
| 1 | New York | NY | USA |
| 2 | Boston | MA | USA |
Note: The ID column is repeated because it contains unique values (detected as a key column).
Tabled automatically detects the input format using heuristics:
- Markdown: Lines starting and ending with
| - SQL dump: Lines with
+---+borders or|delimiters - TSV: Lines containing tab characters
- CSV: Default fallback, comma-separated values
The maximum table width is hardcoded to 100 characters in the CLI. Future versions will support command-line arguments for configuration.
The REST API supports the maxWidth query parameter to configure table width per request (default: 100, minimum: 20).
PORT: HTTP server port (default: 3000)
The browser version provides a simple web interface for formatting tables without any installation. It uses the same parsing and formatting logic as the CLI and API versions.
- Paste any tabular data (CSV, TSV, Markdown, SQL dump)
- Click "Format Table" to convert to markdown
- Copy formatted output to clipboard
- 100% client-side - no data leaves your browser
- Responsive design works on mobile and desktop
# Serve the docs folder with any static file server
cd docs
python3 -m http.server 8080
# Visit http://localhost:8080tabled/
├── src/
│ ├── index.js # CLI entry point (stdio interface)
│ ├── server.js # REST API server
│ ├── parsers.js # Input format detection and parsing
│ └── formatter.js # Markdown table formatting
├── docs/ # GitHub Pages / Browser version
│ ├── index.html # Web interface
│ └── js/
│ ├── parsers.js # Browser-compatible parser (ES modules)
│ └── formatter.js # Browser-compatible formatter (ES modules)
├── test/
│ └── sample-*.txt # Test data files
├── package.json
├── CLAUDE.md # Development documentation
└── README.md
GPL-3.0-or-later
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.