SebastianMC / obsidian-custom-sort

Take full control over the order and sorting of folders and notes in File Explorer in Obsidian
GNU General Public License v3.0
255 stars 19 forks source link

Not alphanumeric, but natural sort order? #27

Closed holroy closed 1 year ago

holroy commented 1 year ago

In your documentation you state that this plugin uses alphanumeric, but it seems to use natural sort order. That is that x7, x8 and x70, is sorted according to the number sequence of 7, 8, 70, and not the alphanumeric sequence of 7, 70, 8.

Is this a bug or a feature? And either way, would it be possible to get it to do true alphanumeric sorting?

In the image below I show the result after applying the sorting specification within my file CustomSort, and how it then doesn't show the files in alphanumeric order. Also included are the sequence of the hexadecimal numbers, 0x01FF, 0x0200 and 0x02FF, which are out of order due to the same issue. The 0x02FF is in the middle instead of at the end. Finally the image shows that the custom sort is effective (which also can be seen by file in reverse sort order outside of the SortingBug folder.

image

Regards, Holroy

SebastianMC commented 1 year ago

Hi @holroy,

you suggested, you received ;-)

In the recent release 1.1.0 I've added the syntax < true a-z and > true a-z to intentionally trigger the true alphabetical order.

More info about the meaning of 'a-z' in this new section of README.md

If you adjust your test sorting spec to:

sorting-spec: |
 target-folder: MaDo/...
 > true a-z
 target-folder: MaDo/Sandbox/SortingBug
 < true a-z

you can enjoy the true alphabetical sorting order which you asked for

regards, Seb

holroy commented 1 year ago

Thanks for the swift response. I've now added the following sorting specifications

sorting-spec: |
  target-folder: /*
  < true a-z

And my files (in whatever folder) comes in true alphanumeric sorting. Thanks again!

Regards, Holroy