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

Tab character raises error instead of being treated as a whitespace #96

Closed SebastianMC closed 1 year ago

SebastianMC commented 1 year ago

This is reported in the community forum by daddydave

The example described there is:

---
sorting-spec: |
    target-folder: /
    order-asc: a-z

    target-folder: Reading
    order-desc: modified
---

the blank line contains >TAB< character, which is the source of the problem.

Investigate why and fix - tabs should be treated as whitespace

daddydave commented 1 year ago

I can confirm that resolved the issue. Thank you so much!!!

SebastianMC commented 1 year ago

Regarding the >TAB< character: a quick verification revealed the fact, that >TAB< is not allowed inside YAML. So in this specific scenario, it is Obsidian YAML parser which fails to read the entire YAML section (because of unexpected >TAB<), before the custom sort plugins has a chance to do anything. In other words, from custom sort plugin perspective, there is no sorting-spec: metadata in the file at all.

The solution it avoid >TAB< in YAML in general, and in the sorting-spec: specifically, no exception.

In the light of the above, there is not much that can be done at the plugin level to prevent >TAB< from generating an error.

References: