Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there any way to make markdown tables sortable?

I'd like to write my table in markdown text, but allow it to be sortable on github after its been rendered(simple asc/desc sorting by clicking on the column header.

Any way to do this?

like image 787
thouliha Avatar asked Mar 16 '17 19:03

thouliha


People also ask

How do I make a table sortable?

How to Make Sortable Tables. Adding the "sortable" class to a <table> element provides support for sorting by column value. Clicking the column headers will sort the table rows by that column's value. Tables must use <thead> and <th> tags for sortable functionality to work.

Can you make a table in markdown?

Tables. To add a table, use three or more hyphens ( --- ) to create each column's header, and use pipes ( | ) to separate each column. For compatibility, you should also add a pipe on either end of the row.

What is a sortable table?

This script allows a table to be sorted by the column headers, in ascending or descending order.


Video Answer


1 Answers

Table sort is not supported in Github flavored markdown but one alternative is to use user script such as Github Sort Content

It's very easy to install, for instance from Chrome :

  • install Tampermonkey

  • install Github Sort Content from Greasyfork

Then tables from github.com markdown pages can be sorted like :

enter image description here

like image 56
Bertrand Martel Avatar answered Sep 21 '22 12:09

Bertrand Martel