@tofrankie/prettier-plugin-compact-markdown-table
v0.0.2
Published
Prettier plugin for compact markdown tables without cell padding or alignment
Downloads
376
Maintainers
Readme
prettier-plugin-compact-markdown-table
Forked from myl7/prettier-plugin-compact-markdown-table
Prettier plugin for compact markdown tables without column alignment
Resolves prettier/prettier#12074, prettier/prettier#14722, prettier/prettier#16954.
Features
- Compact tables: Reduce separators and avoid column alignment while preserving readable cell spacing by default.
- Save LLM tokens: A 5-column, 10-row table saves ~21% of table tokens and ~32% of characters with compact formatting.
- Fit character limits: Useful for submissions with strict character budgets, e.g., OpenReview rebuttals capped at 5000 characters.
Prerequisites
- Prettier >= 3.0.0
Get Started
Install the plugin alongside Prettier:
npm install @tofrankie/prettier-plugin-compact-markdown-table -DAdd the plugin to your prettier.config.js:
export default {
plugins: ['@tofrankie/prettier-plugin-compact-markdown-table'],
}Or import the default plugin object:
import compactMarkdownTablePlugin from '@tofrankie/prettier-plugin-compact-markdown-table'
export default {
plugins: [compactMarkdownTablePlugin],
}Then format as usual:
prettier --write "**/*.md"Before:
| Name | Age | City |
| ----- | --- | ---- |
| Alice | 30 | NYC |
| Bob | 25 | LA |After:
| Name | Age | City |
| --- | --- | --- |
| Alice | 30 | NYC |
| Bob | 25 | LA |Config
tableLayout
| Value | Description |
| :-- | :-- |
| compact (default) | Compact layout with one space around each cell. |
| compact-no-padding | Compact layout without cell padding. |
| aligned | Pad cells to align columns (Prettier default). |
Set in prettier.config.js:
export default {
tableLayout: 'compact'
}Or pass via CLI:
prettier --table-layout aligned --write "**/*.md"License
Copyright (C) 2026 Yulong Ming [email protected]
Apache License, Version 2.0
