vrtmrz / obsidian-tagfolder

MIT License
211 stars 17 forks source link

Hierarchy order alphabetical #54

Open Ayylias opened 1 year ago

Ayylias commented 1 year ago

Is it intended that the hierarchy renders as alphabetical when using multiple individual tags instead of reading order?

For example if I have tags '#linux #android'. The folder structure shows:

-android
    -linux
        -notes

But if I set it to #linux #xandroid'. The folder structure would be

-linux
    -xandroid 
        -notes

I can use nested tags for this to make the hierarchy correct (#linux/android), but i'd prefer to keep them separate in some cases for aesthetic reasons while in Obsidian Graph View (ie, links going to two tag nodes instead of 1).

j-adel commented 1 year ago

I don't think there's a way to inside TagFolder to detect tag order. I don't think there's a way in the entirety of Obsidian actually as the list of Tags in a note is not ordered based on their order in the note, afaik.

vrtmrz commented 1 year ago

Thank you for using this plugin! As @j-maffe follows, tag order cannot be left in nature.

Otherwise, the order could be unstable or non-intuitive if we have both "#linux #android" and "#android #linux". It might harder to find a specific one.

Not sure if this helps, we can pin and set different orders between pins. Once you pinned the tag, we will find taginfo.md on our vault. This file contains information on pinned tags, and they are able to have key to sort them.

maxoja commented 8 months ago

@vrtmrz do you have some examples to show how the structure of taginfo.md should look like? I'm trying to pin&order as well but struggle to find information of how exactly to define key/marker/etc properties.

and is the sorting used for listing order (which tag comes first on the list vertically), or it's more for hierarchical order (which pinned tag should be outer or inner)?

vrtmrz commented 8 months ago

Sorry for being late! This table is the specification of entries of taginfo.md.

When tags are sorted by their name, there are following rules.

  1. Intermediate tags and normal tags are separated. (Intermediate tags have priority).
  2. Pinned and non-pinned tags are separated. (Pinned tags have priority). 2-1. Pinned tags are just sorted by the key property.
  3. Tags are sorted by their name.

All sorts are performed by numeric sort. (However, I have left how to order to the browser engine which Obsidian is on). I would be happy if this explanation is what you are looking for.