Registry / devops / prettier-markdown-table

prettier-markdown-table

JSON →
library1.0.3jsnpmunverified

A Prettier plugin that automatically formats tables in Markdown files by adjusting column widths and ensuring alignment. Version 1.0.3, released in 2024, requires Prettier ^3.3.2 and linguist-languages ^7.27.0. Unlike general prettier plugins, this focuses solely on Markdown tables, providing consistent formatting for tables with long content. It is a simple, single-purpose plugin without alternative table formatting tools in the npm ecosystem.

npm install prettier-markdown-table
INSTALL
IMPORT
SIG · PRETTIER-MARKDOWN-
P
prettier-markdown-table
devopsjavascriptv1.0.3
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default export
In .prettierrc, add "prettier-markdown-table" to the plugins array.
Using require() or import syntax inside .prettierrc is incorrect.
The plugin is not imported in your code; it is loaded by Prettier via configuration.

Shows how to enable the plugin in .prettierrc and format a markdown file containing a table.

// .prettierrc { "trailingComma": "es5", "tabWidth": 2, "semi": false, "plugins": ["prettier-markdown-table"] } // Run prettier on a markdown file with a table: // echo "| a | b | c |" > test.md // npx prettier --write test.md // After formatting, the table will be aligned.
Debug
Known issues
gotchaPlugin only activates when Prettier processes markdown files; it will not affect non-markdown files.
fix
Ensure your file extension is .md or .markdown and that prettier is configured to parse it.
affects: >=1.0.0
gotchaThe plugin requires Prettier v3.3.2 or newer. Using older versions will cause plugin loading failure.
fix
Update prettier to ^3.3.2 or later.
affects: >=1.0.0
Errors
Common errors & fixes
Could not load plugin 'prettier-markdown-table'.
Plugin not installed or peer dependencies missing.
fix
Run 'npm install prettier-markdown-table' and ensure prettier is installed.
Cannot find module 'linguist-languages'
Missing peer dependency linguist-languages.
fix
Run 'npm install linguist-languages' or ensure it is in your package.json.
Upgrade
Version history
1.0.3latest on npm
Audit
Dependencies
linguist-languagesoptionalpeer dependency used for language detection
prettieroptionalpeer dependency required as the host formatter
Agent activity
4 hits · last 30 days
node
4
Resources
prettier-markdown-table — npm install prettier-markdown-table · libregistry