Registry /
devops / prettier-plugin-sort-markdown-table
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslnode 18–226 runs
build_error
glibcnode 18–226 runs
build_error
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
plugin
✓ plugins: [require('prettier-plugin-sort-markdown-table')]
✗ import prettierPluginSortMarkdownTable from 'prettier-plugin-sort-markdown-table'
Prettier plugins are typically loaded via require in .prettierrc.js or prettier.config.js; ESM import is not recommended for plugin registration.
default export
✓ export default { plugins: ['prettier-plugin-sort-markdown-table'] }
✗ import { default } from 'prettier-plugin-sort-markdown-table'
The package does not export any symbols for programmatic usage; it only registers as a Prettier plugin.
CLI usage
✓ npx prettier --plugin=prettier-plugin-sort-markdown-table --write README.md
✗ prettier --plugin='prettier-plugin-sort-markdown-table' README.md
The plugin must be specified with --plugin flag when running prettier CLI if not auto-loaded.
Installs the plugin, configures Prettier to load it automatically, then formats a markdown table with the opt-in comment.
npm i -D prettier prettier-plugin-sort-markdown-table
cat > .prettierrc.js << 'EOF'
module.exports = {
plugins: ['prettier-plugin-sort-markdown-table'],
};
EOF
cat > README.md << 'EOF'
<!-- prettier-sort-markdown-table -->
| name | email |
| ---- | ----- |
| zhang | zhang@a.com |
| wang | wang@a.com |
| alice | alice@example.com |
EOF
npx prettier --write README.md
# Output README.md rows sorted by first column alphabetically: alice, wang, zhang
Errors
Common errors & fixes
Error: Cannot find module 'prettier-plugin-sort-markdown-table'
Plugin not installed or not in node_modules.
fixRun `npm i -D prettier-plugin-sort-markdown-table`
Error: Invalid plugin: prettier-plugin-sort-markdown-table
Prettier version is too old (pre v3) or plugin is not compatible.
fixUpgrade Prettier to 3.x and use plugin v2.0.0 or later
Error: [pretty-quick] No files matching the pattern found in the working tree.
Running pretty-quick without specifying markdown files, or using wrong glob pattern.
fixUse `pretty-quick --pattern '**/*.md'`
Audit
Dependencies
prettierrequiredpeer dependency — plugin requires Prettier 3.x