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
287 stars 22 forks source link

Plugin ignores sort spec sort order #121

Closed lazlo2424 closed 8 months ago

lazlo2424 commented 8 months ago

The plugin sorts the files and folders equally (Wonderful), however no configuration sorts a to z, instead it is always z - a Here is the configuration file I am using

I have also switched to > a-z but the sort is always backwards. The documentation says it should just work but maybe I am missing something.

sorting-spec: | // // A simple configuration for obsidian-custom-sort plugin // (https://github.com/SebastianMC/obsidian-custom-sort) // It causes the plugin to take over the control of the order of items in the root folder ('/') of the vault // It explicitly sets the sorting to ascending ('<') alphabetical ('a-z') // Folders and files are treated equally by the plugin (by default) so expect them intermixed // after enabling the custom sort plugin // target-folder: /* < a-z

SebastianMC commented 8 months ago

Hi @lazlo2424,

the problem which you encountered seems to be very confusing and I think that the quickest way of verification is to re-start from scratch. Please ensure that you have only a single note sortspec (the underlying file is sortspec.md). If you have multiple instances of sortspec notes, delete all of them and create a single empty one from scratch in the root folder of the vault. Open the sortspec note (in Obsidian) and enable the source mode (menu View -> Source Mode). This will prevent the Obsidian properties editor from interfering. Having done the above, type in the simplest sorting specification as below, exactly as visible with the exact indentation (two spaces) on the two lines target-folder: /* and < a-z:

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

After that click the ribbon button (once or twice) to reload the sorting specification and apply it. The alphabetical (a to z) sorting should be applied in result. Finally, remember to disable the source mode (menu View -> Source Mode)

If you have further questions or concerns, please continue here

lazlo2424 commented 8 months ago

Thanks for the reply.

You are correct. It is very strange.

I think I will make a video of me doing it as I have been very careful to closely follow the very detailed instructions…

The sorting of files and folders worked perfectly as they merged together. It was only the sort order that did not work.

Video coming shortly..

On 22 Jan 2024, at 10:55, SebastianMC @.***> wrote:

Hi @lazlo2424 https://github.com/lazlo2424,

the problem which you encountered seems to be very confusing and I think that the quickest way of verification is to re-start from scratch. Please ensure that you have only a single note sortspec (the underlying file is sortspec.md). If you have multiple instances of sortspec notes, delete all of them and create a single empty one from scratch in the root folder of the vault. Open the sortspec note (in Obsidian) and enable the source mode (menu View -> Source Mode). This will prevent the Obsidian properties editor from interfering. Having done the above, type in the simplest sorting specification as below, exactly as visible with the exact indentation (two spaces) on the two lines target-folder: /* and < a-z:


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

After that click the ribbon button (once or twice) to reload the sorting specification and apply it. The alphabetical (a to z) sorting should be applied in result. Finally, remember to disable the source mode (menu View -> Source Mode)

If you have further questions or concerns, please continue here

— Reply to this email directly, view it on GitHub https://github.com/SebastianMC/obsidian-custom-sort/issues/121#issuecomment-1903750321, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX6DJHZEUZVPQL3R2CFK2LYPZAQ7AVCNFSM6AAAAABCD4BNO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBTG42TAMZSGE. You are receiving this because you were mentioned.

lazlo2424 commented 8 months ago

Hi

I know what caused the issue. User error on my part.

Once the properties are in the sortspec.md file and the file is viewed within Obsidian, the properties are hidden. When I looked at the the file I code see valid code


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

But this was below the front matter hidden in the properties. So it looked correct but my first attempt which sorted in reverse which is now hidden in the front matter was hidden.

When I opened it in an external editor the sortspec.md file looked like this.


sorting-spec: | target-folder: /*

a-z —


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

Where the instruction was in the front matter but what was visible to the user (me) was the second half.

Sorry for the intrusion.

Regards Matt

On 22 Jan 2024, at 10:55, SebastianMC @.***> wrote:

Hi @lazlo2424 https://github.com/lazlo2424,

the problem which you encountered seems to be very confusing and I think that the quickest way of verification is to re-start from scratch. Please ensure that you have only a single note sortspec (the underlying file is sortspec.md). If you have multiple instances of sortspec notes, delete all of them and create a single empty one from scratch in the root folder of the vault. Open the sortspec note (in Obsidian) and enable the source mode (menu View -> Source Mode). This will prevent the Obsidian properties editor from interfering. Having done the above, type in the simplest sorting specification as below, exactly as visible with the exact indentation (two spaces) on the two lines target-folder: /* and < a-z:


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

After that click the ribbon button (once or twice) to reload the sorting specification and apply it. The alphabetical (a to z) sorting should be applied in result. Finally, remember to disable the source mode (menu View -> Source Mode)

If you have further questions or concerns, please continue here

— Reply to this email directly, view it on GitHub https://github.com/SebastianMC/obsidian-custom-sort/issues/121#issuecomment-1903750321, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAX6DJHZEUZVPQL3R2CFK2LYPZAQ7AVCNFSM6AAAAABCD4BNO2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMBTG42TAMZSGE. You are receiving this because you were mentioned.

lazlo2424 commented 8 months ago

It is worth noting that once the sortspec configuration is stored in the front matter of the sortspec.md file, it will become invisible if you are hiding properties within Obsidian. This reported issue was user error on my part and I am going to close the issue accordingly.

SebastianMC commented 8 months ago

Hi @lazlo2424

thank you for your input!

Your voice was important and was a direct reason to create #125, which could improve user experience and prevent issues like you encountered.

thanks!