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
260 stars 19 forks source link

[Feature Request] Allow Custom Sorting Specs inside plugin settings #11

Closed ocreturner closed 1 year ago

ocreturner commented 1 year ago

Would be great for the plugin settings to allow the user to define the sorting options instead of needing a note. I wanted to at least hide the note using ".sortspec.md" but it won't read it if its hidden.

a plugin that allows this is called supercharged links https://github.com/mdelobelle/obsidian_supercharged_links

maybe the settings this plugin provides will inspire and make it easier to provide

This is a great plugin that a lot of people will love! thanks for your work

SebastianMC commented 1 year ago

Hi @Obadiahcruz !

when creating the plugin, the approach was to keep the sorting rules specification intentionally in a note (or spread over more notes). This is to be able to copy the sorting when copying (or moving) the notes to a different folder or a different vault or when archiving the notes. For that purpose, the sorting specification can reside in:

Keeping the yaml in front matter of some note has the additional advantage of obsidian notes editor support - basic syntax highlighting, collapsing the sorting-spec: | value, etc.

The plugin also supports an experimental undocumented feature which allows hiding of the sortspec.md note (or any other notes or folders) in file explorer via the syntax:

/--hide: sortspec.md

Yet, this feature is experimental and intentionally kept undocumented because it could easily confuse the user:

Allowing the user to specify sorting configuration in a text field of plugin settings is an easy task, from development perspective. Yet because of the reasons listed above I intentionally resigned from adding it.

Obviously no problem with adding it if people find it useful

Before that, could you please see maybe the below approach works for you?

If you put the below sorting specification in the file sortspec.md in root folder, it will:

---
sorting-spec: |
 // Let the plugin take over the control of sorting in the root folder and mimic default Obsidian sorting
 target-folder: /
 /folders ...
  < a-z
 /:files
  < a-z

 /--hide: sortspec.md
---

You can extend the above specification with sorting rules for other (sub)folders, as needed

Let me know what you think

SebastianMC commented 1 year ago

Hi @Obadiahcruz! not having any further feedback from you, I'm about to convert this ticket into a discussion. Seeing how people struggle with the basic step of putting a basic sortspec.md to work I'm looking towards some more less technical and more user-friendly options. While introducing the 'sorting specification in plugin setting page' is contrary to some basic ideas behind the plugin and it poses its own challenges, still it looks like one of viable long-term directions for this plugin.