Generate well-formatted markdown tables from data with proper alignment and spacing. Use for report statistics, comparison tables, or summary data presentation.
Create properly formatted markdown tables with alignment and consistent spacing.
Accept headers and rows as input.
Expected Input:
{
"headers": ["Column 1", "Column 2", "Column 3"],
"rows": [
["Value 1", "Value 2", "Value 3"],
["Value 4", "Value 5", "Value 6"]
],
"alignment": ["left", "center", "right"]
}
Alignment (optional):
left: Left-aligned (default)center: Center-alignedright: Right-alignedDetermine maximum width for each column.
Width Calculation:
Create header row with proper spacing.
Format:
| Header 1 | Header 2 | Header 3 |
Create separator with alignment indicators.
Alignment Indicators:
:--- or ---:---:---:Format:
|----------|:--------:|---------:|
Create data rows with consistent spacing.
Format:
| Value 1 | Value 2 | Value 3 |
| Value 4 | Value 5 | Value 6 |
Return formatted markdown table.
Expected Output:
| Column 1 | Column 2 | Column 3 |
|----------|:--------:|---------:|
| Value 1 | Value 2 | Value 3 |
| Value 4 | Value 5 | Value 6 |
Input:
{
"headers": ["Metric", "Count", "Percentage"],
"rows": [
["Critical Bugs", "3", "13%"],
["High Bugs", "8", "35%"],
["Medium Bugs", "12", "52%"]
],
"alignment": ["left", "right", "right"]
}
Output:
| Metric | Count | Percentage |
|---------------|------:|-----------:|
| Critical Bugs | 3 | 13% |
| High Bugs | 8 | 35% |
| Medium Bugs | 12 | 52% |
Input:
{
"headers": ["Feature", "Before", "After"],
"rows": [
["Build Time", "45s", "12s"],
["Test Time", "2m 30s", "1m 15s"],
["Bundle Size", "2.3 MB", "1.8 MB"]
],
"alignment": ["left", "center", "center"]
}
Output:
| Feature | Before | After |
|-------------|:-------:|:-------:|
| Build Time | 45s | 12s |
| Test Time | 2m 30s | 1m 15s |
| Bundle Size | 2.3 MB | 1.8 MB |
Input:
{
"headers": ["Priority", "Open", "Fixed", "Total"],
"rows": [
["P0", "2", "5", "7"],
["P1", "5", "3", "8"],
["P2", "12", "8", "20"]
]
}
Output:
| Priority | Open | Fixed | Total |
|----------|------|-------|-------|
| P0 | 2 | 5 | 7 |
| P1 | 5 | 3 | 8 |
| P2 | 12 | 8 | 20 |
Input:
{
"headers": ["Name", "Value", "Status"],
"rows": []
}
Output:
| Name | Value | Status |
|------|-------|--------|
examples.md: Table formatting examples (see Supporting Files section)