A plugin for Markdown It to sort table by content
npm install markdown-it-table-sort
A plugin for Markdown It to sort table by content.
sh
pnpm i markdown-it-table-sort -D
`
Usage
`ts
import md from 'markdown-it'
import tableSort from 'markdown-it-table-sort'
md().use(tableSort)
// With options
md().use(tableSort, { reverse: true })
`
Options
`ts
export interface PluginOptions {
/**
* Whether to reverse the sorted result
*
* @default false
*/
reverse?: boolean,
/**
* Specify a method to sort rows by content
*/
sortRows?: (prev: string[], next: string[]) => number
}
``