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
301 stars 23 forks source link

'true a-z' makes 'Name ABC' comes earlier than 'Name' #123

Closed SebastianMC closed 10 months ago

SebastianMC commented 10 months ago

Discussed in https://github.com/SebastianMC/obsidian-custom-sort/discussions/122

Originally posted by **cmasfo** January 22, 2024 This happens because space( ) comes earlier than dot(.) of the file extension part(.md). Same things happen in vs code. how do i solve this?
SebastianMC commented 10 months ago

It looks for me as a retro-bug which slipped in as the sorting was getting more and more complex. Indeed the fullname (basename + extension) is being used for sorting of files unconditionally in all cases, which results in the reported problem. It applies for both true alphabetical (true a-z) and plain alphanumeric (a-z) sorting. The original intention was to use the basename of notes (files) for sorting, until explicitly indicated to use full filename in sorting specification.

No simple workarounds exist now in the plugin - I created a bug #123 to address the issue. Complex workarounds exist, but I prefer to invest my time in resolving the bug instead of creating non-trivial documentation for workarounds.

At a glance the fix seems to be easy and quick. At the same time if I want to keep backward compatibility (e.g. sorting of different types of files in the same folder) and also allow for conscious selection of file basename vs. full filename, I need to give some more thought to the solution.

An additional remark from @cmasfo is to include unicode support

SebastianMC commented 10 months ago

Feature implemented.

Now the sorting uses basename of file (w/o extension). New syntax a-z. and true a-z. introduced to allow explicitly sorting by filename with ext

SebastianMC commented 10 months ago

Included in release 2.1.3