markdown-it-table-sort icon indicating copy to clipboard operation
markdown-it-table-sort copied to clipboard

A plugin for Markdown It to sort table by content.

markdown-it-table-sort

A plugin for Markdown It to sort table by content.

version license

English | 中文

Install

pnpm i markdown-it-table-sort -D

Usage

import md from 'markdown-it'
import tableSort from 'markdown-it-table-sort'

md().use(tableSort)

// With options
md().use(tableSort, { reverse: true })

Options

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
}

Contributors

Thanks for all the contributions!

License

MIT License.