Skip to content

SevenOutman/prettier-plugin-sort-markdown-table

Folders and files

NameName
Last commit message
Last commit date

Latest commit

69b2c63 · May 12, 2023

History

16 Commits
May 12, 2023
Feb 14, 2023
Feb 16, 2023
Feb 16, 2023
Feb 14, 2023
Feb 13, 2023
Feb 14, 2023
Feb 21, 2023
May 12, 2023
May 12, 2023
Feb 13, 2023
Feb 13, 2023
Feb 20, 2023

Repository files navigation

prettier-plugin-sort-markdown-table

npm version npm downloads codecov

Prettier plugin that sorts markdown tables according to their first column.

Install

npm i -D prettier-plugin-sort-markdown-table

Prettier should automatically load this plugin once it's installed, you don't have to do manual configuration.

Usage

Annotate tables you want to sort with <!-- prettier-sort-markdown-table --> comment.

For example:

<!-- prettier-sort-markdown-table -->
| name | email | description |
| -- | -- | --- |
| zhang | zhang@a.com  | zhang  |
| wang | wang@a.com   | wang |
| li | li@a.com   | li  |
| amity | amity@a.com  | amity  |
| batman | batman@a.com | batman |

Becomes:

<!-- prettier-sort-markdown-table -->

| name   | email        | description |
| ------ | ------------ | ----------- |
| amity  | amity@a.com  | amity       |
| batman | batman@a.com | batman      |
| li     | li@a.com     | li          |
| wang   | wang@a.com   | wang        |
| zhang  | zhang@a.com  | zhang       |

License

MIT © Doma