Open-source CLI tool
Keep your Markdown tables tidy
Tablemark is a tiny command-line formatter that aligns columns, normalizes separators and sorts rows in Markdown tables. Point it at a file or a whole folder and let it clean up the diff noise for you.
Zero config
Sensible defaults that match the GitHub-flavored Markdown spec. Drop in a config file only when you need to.
Format in place
Run on a single file, a glob, or a directory. A --check mode plays nicely with CI and pre-commit hooks.
No runtime
Ships as a single static binary for Linux, macOS and Windows. Nothing to install alongside it.
Predictable diffs
Stable column widths and consistent padding mean tables only change when their content does.
Installation
Pick the method that fits your setup. Prebuilt binaries are the simplest; package managers keep things up to date.
Shell installer (Linux / macOS)
# downloads the latest release into ~/.local/bin
curl -fsSL https://get.tablemark.dev/install.sh | sh
Homebrew
brew install tablemark
Cargo
cargo install tablemark
Manual download
Grab the archive for your platform from the releases page, unpack it, and move the tablemark binary somewhere on your PATH:
tar -xzf tablemark-1.4.2-x86_64-linux.tar.gz sudo mv tablemark /usr/local/bin/
tablemark --version. You should see tablemark 1.4.2.Quick start
Suppose you have a file pricing.md with a slightly ragged table:
| Plan | Seats | Monthly | |---|---|---| | Starter | 3 | $0 | | Team | 25 | $19 | | Business | unlimited | $49 |
Format it in place with a single command:
tablemark pricing.md
Tablemark rewrites the table so every column lines up and the separator row matches:
| Plan | Seats | Monthly | | -------- | --------- | ------- | | Starter | 3 | $0 | | Team | 25 | $19 | | Business | unlimited | $49 |
To check files without changing them — handy in continuous integration — use --check. It exits with a non-zero status if anything would be reformatted:
tablemark --check docs/**/*.md
tablemark --check . to a pre-commit hook so unformatted tables never reach your main branch.Commands & flags
The interface is intentionally small. Running tablemark --help prints the full list.
| Flag | Description |
|---|---|
--check | Report files that need formatting and exit non-zero. Makes no changes. |
--stdin | Read from standard input and write the result to standard output. |
--sort <col> | Sort rows by the given column index (1-based). Header and separator stay put. |
--align <mode> | Force alignment: left, right, center or preserve. |
--config <path> | Use a specific config file instead of searching upward from the working directory. |
--quiet | Suppress the per-file summary. Errors are still printed. |
Working with a pipe
Because --stdin reads and writes streams, Tablemark composes well with other tools:
pbpaste | tablemark --stdin --align center | pbcopy
Configuration
Defaults cover most projects, but you can commit a .tablemark.toml file to the repository root to share settings with your team. Tablemark searches the current directory and walks up the tree until it finds one.
# .tablemark.toml [format] # padding inside each cell, in spaces cell_padding = 1 # keep a trailing newline at end of file trailing_newline = true # default column alignment when none is declared default_align = "left" [behavior] # skip files matching these glob patterns exclude = ["CHANGELOG.md", "vendor/**"] # collapse runs of blank lines around tables tidy_blank_lines = true
The available keys are summarized below. Any key you leave out keeps its default value.
| Key | Default | Meaning |
|---|---|---|
cell_padding | 1 | Spaces added on each side of a cell's content. |
trailing_newline | true | Ensure files end with exactly one newline. |
default_align | "left" | Alignment applied to columns with no explicit marker. |
exclude | [] | Glob patterns that are never touched. |
tidy_blank_lines | false | Normalize blank lines surrounding each table. |
Editor integration
Tablemark works as a plain external formatter, so most editors can call it on save without a dedicated plugin.
VS Code (Run on Save)
{
"emeraldwalk.runonsave": {
"commands": [
{ "match": "\\.md$", "cmd": "tablemark ${file}" }
]
}
}
Neovim
vim.api.nvim_create_autocmd("BufWritePost", {
pattern = "*.md",
command = "silent !tablemark %",
})
Changelog
1.4.2 — March 2025
- Fixed a panic when a table row contained an escaped pipe (
\|) inside inline code. --checknow prints the relative path of each offending file.
1.4.0 — January 2025
- Added the
--sortflag for ordering rows by a column. - Config files are now discovered by walking up the directory tree.
- Windows ARM64 binaries are published with each release.
1.3.1 — October 2024
- Improved handling of full-width (CJK) characters when measuring column widths.
FAQ
Does it change anything outside tables?
No. Tablemark only rewrites the lines that form a valid Markdown table. Surrounding prose, headings and code fences are left exactly as they are (aside from optional blank-line tidying, which is off by default).
What about very wide tables?
Columns are padded to the width of their longest cell. Tablemark does not wrap content or truncate it, so a wide table stays wide — it just becomes consistently aligned.
Can I undo a run?
Tablemark edits files in place and keeps no backups, so commit or stash your work first. Using --check in CI is the recommended way to avoid surprises.
Source & license
Tablemark is released under the MIT License. The source, issue tracker and release notes live in the project's Git repository. Contributions are welcome — please open an issue before sending a large change so we can discuss the approach.
If you hit a bug, a minimal .md file that reproduces it makes a report far easier to act on.