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

Confusing example "Specify rules for multiple folders" #140

Closed oschrenk closed 8 months ago

oschrenk commented 8 months ago

I was trying to apply a single rule to multiple folders. And the given example is either not quite correct or I am missing some information

/
├── 01 Inbox
├── 10 Journals
│   ├── Personal
│   ├── Private
│   ├── Work
│   └── sortspec.md
...
├── 20 Projects
...

with

sorting-spec: |
    target-folder: Personal
    target-folder: Private    
    target-folder: Work
    /:files
     > a-z
    /folders
     > a-z
    sortspec

Looking at

https://github.com/SebastianMC/obsidian-custom-sort/blob/master/docs/advanced-README.md#example-8-specify-rules-for-multiple-folders

this should apply the rule but I have to relativize the target folder to make it work

sorting-spec: |
    target-folder: ./Personal
    target-folder: ./Private    
    target-folder: ./Work
    /:files
     > a-z
    /folders
     > a-z
    sortspec

Is the example not quite accurate or am I missing something?

v2.1.8

SebastianMC commented 8 months ago

Hi @oschrenk

the documentation of the plugin needs integration, clean up and updates. The work on it is pending slowly in the background under #66

Until then I've added a simple table of contents to the manual.md document - there is a section describing in details all the options available for target-folder: plus clarification of each. Direct link to that section: Options for target-folder: matching. Probably this makes it a bit easier to locate relevant information in the existing fragmented and scattered docs.

In short: the parameter of target-folder: is by default treated as a full path (from vault root) to the folder. So a line like target-folder: Private specifies the Private folder at root level of the vault. And if you want to use a relative path the solution is exactly what you applied.

Indeed, the examples in documentation could be confusing. Personally I would prefer to use the filesystem-paths conventions (e.g. a path not starting with '/' is treated as a relative path), yet I intentionally followed the internal conventions of Obsidian. For example, if you look how you configure some paths in Obsidian, e.g. specify folder for attachments in the UI - the name is treated as an absolute path, no prefix of '/' allowed

oschrenk commented 8 months ago

Thank you for the clarification. All the examples (targeting folders) assumes that the sortspec is living in root. Then it makes sense.

In the manual there is also a section that is illuminating:

https://github.com/SebastianMC/obsidian-custom-sort/blob/master/docs/manual.md#by-folder-path-the-default

Especially

target-folder: ./Some Subfolder this refers to path of a sub-folder of the folder where the sorting specification resides (the specification containing the line, keep in mind that the sorting specification can reside in multiple locations in multiple notes)

I think I was thrown off by the comment

Personally I find convenient to keep sorting specification of all folders in a vault in a single place, e.g. in a dedicated note Inbox/Inbox.md

and I somehow assumed tfrom there hat it was always relative. But having now read more examples and more of the manual it makes sense. There are some powerful options in this plugin - thank you.