Sort rows of a multimarkdown table

Here are two macros that sort the rows of a multimarkdown stile (pipe style) table.
The rows are sorted in ascending or descending order based on the values of a user selected column of the table.
The base column can be specified in the user prompt displayed on macro launch.
Check the "Number sorting" checkmark if the column contains numeric values so that numbers are sorted based on their value and not alphabetically (e.g. in ascending order 89 will be sorted before 123).


To use the macro you have to select all the rows of the table except the first two rows (i.e. heading row and heading separation line) and then run the macro; see next image:

Please notice that the macros don't have any trigger. You have to move them to the macro group enabled for your Multimardown editor of choice and assign them a trigger.


If something goes wrong it is possible to revert to the previous state of your table pressing ⌘Z ("Undo" command) two times but I strongly suggest to test the macros with dummy data.

I didn't test them extensively so let me know if you find something wrong or some better implementation.


Applescript taken form a KM macro by Gabe Weatherhead.

Sort MMD table macros.kmmacros (20.7 KB)