obsidian-sortable
obsidian-sortable copied to clipboard
Implement parsers for various data types + auto-detect data type
From https://meta.wikimedia.org/wiki/Help:Sorting:
The way items are sorted depends on the data type of the first rows. To determine the data type, the first 5 non-blank rows below the header are tested after loading the page and the most appropriate format is chosen. Mismatches are possible. The sort order of a column can be forced [using
data-sort-type="..."
].
jquery.tablesorter.js
defines the following parsers:
- [ ] 1. (fallback, default) text
- [ ] 2. IPAddress
- [ ] 3. currency
- [ ] 4. url
- [x] 5. isoDate
- [ ] 6. usLongDate
- [ ] 7. date
- [ ] 8. time
- [ ] 9. number
then it tries to detect parser for column.
This may be the most straightforward way of dealing with multiple data types and ensure minimal tinkering on user's part.