Registry / devops / markdown-table-formatter

markdown-table-formatter

JSON →
library1.7.0jsnpmunverified

A CLI tool to format markdown tables in files, built on top of markdown-table-prettify. Version 1.7.0 requires Node >=18.0.0. It offers both formatting and check-only modes, supports glob patterns, and allows custom column padding. It is designed for CI integration and is actively maintained with regular releases.

npm install markdown-table-formatter
INSTALL
IMPORT
SIG · MARKDOWN-TABLE-FOR
M
markdown-table-formatter
devopsjavascriptv1.7.0
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.

Formatter
import { Formatter } from 'markdown-table-formatter'
const Formatter = require('markdown-table-formatter')
Since v1.0, the package is ESM-only. CommonJS require() will not work.
formatFile
import { formatFile } from 'markdown-table-formatter'
Use for programmatic formatting of a single file.
checkFile
import { checkFile } from 'markdown-table-formatter'
Returns a boolean indicating if the file would be changed.

Shows CLI usage for formatting and checking markdown tables, plus programmatic import in ESM.

// Install: npm install -g markdown-table-formatter // CLI: format all markdown files in current directory markdown-table-formatter // Check only (exit code 1 if files need formatting) markdown-table-formatter --check **/*.md // Programmatic usage (ESM) import { formatFile } from 'markdown-table-formatter'; await formatFile('README.md');
Debug
Known issues
breakingSince v1.0, the package is ESM-only. Node <18 is not supported.
fix
Upgrade Node to >=18.0.0 and use import instead of require.
affects: >=1.0.0
deprecatedCLI option --columnpadding was renamed to -p/--column-padding in v1.2.0.
fix
Use -p or --column-padding instead of --columnpadding.
affects: >=1.2.0
gotchaThe --check option does not modify files; it returns exit code 1 if any file would be changed. This can break CI pipelines unintentionally.
fix
Use --check only for validation; run without --check to actually format.
affects: >=0.1.0
gotchaWhen using glob patterns, enclose them in quotes to prevent shell expansion (e.g., "**/*.md").
fix
Use quotes: markdown-table-formatter "**/*.md"
affects: >=0.1.0
Errors
Common errors & fixes
Error: Cannot find module 'markdown-table-formatter'
Missing local install or global install not in PATH.
fix
Run: npm install -g markdown-table-formatter, or use npx: npx markdown-table-formatter
SyntaxError: Cannot use import statement outside a module
Using ESM import in a CommonJS project.
fix
Add "type": "module" to package.json or use .mjs extension.
Error: Requires Node.js version >=18.0.0
Running an older Node.js version.
fix
Upgrade Node.js to 18 or later.
Upgrade
Version history
1.7.0latest on npm
Audit
Dependencies
markdown-table-prettifyrequiredCore formatting engine
Agent activity
2 hits · last 30 days
node
2
Resources
markdown-table-formatter — npm install markdown-table-formatter · libregistry