Auto-format Markdown tables with perfect column alignment. Sort by any column, add/remove columns, and fix misaligned tables instantly.
Features
Auto-Format Tables
Format all tables in a Markdown file with one command. Column content is padded to equal widths for perfect readability in source.
Before:
| Name | Role | Joined |
|---|---|---|
| Alice | Engineer | 2023 |
| Bob | Designer | 2024-01-15 |
After:
| Name | Role | Joined |
| ----- | -------- | ---------- |
| Alice | Engineer | 2023 |
| Bob | Designer | 2024-01-15 |
Sort by Column
Sort any table's data rows by a selected column — ascending or descending. Numeric values are sorted numerically; text values use natural locale sort.
Add / Remove Columns
Add a new column (with a custom header) or remove any existing column via a quick-pick dropdown.
Insert Row
Insert an empty row below the cursor position inside any table.
Format on Save
Enable mdTableFormatter.formatOnSave to automatically align all tables every time you save a Markdown file.
Commands
| Command | Keybinding | Description |
|---|---|---|
| Format All Tables | Alt+Shift+F |
Format every table in the file |
| Format Table at Cursor | Alt+F |
Format the table under the cursor |
| Sort Column Ascending | — | Sort current table ASC by chosen column |
| Sort Column Descending | — | Sort current table DESC by chosen column |
| Add Column | — | Append a new column to current table |
| Remove Column | — | Remove a column from current table |
| Insert Row | — | Insert empty row below cursor |
All commands are also available via the right-click context menu in any Markdown file.
Settings
| Setting | Default | Description |
|---|---|---|
mdTableFormatter.formatOnSave |
false |
Auto-format on save |
mdTableFormatter.columnPadding |
1 |
Extra spaces around cell content |
mdTableFormatter.alignHeaderSeparator |
true |
Align separator row to column width |
Installation
- Open VS Code
- Press
Ctrl+P - Type
ext install miccho27.markdown-table-formatter - Press Enter
License
MIT