Group by heading in the same order as is the file #2843
-
I love the
The headings are sorted somehow but not in the order they appear in my tasks note. Is there a way to explicitly set the order of the headings? I did find one solution on the Obsidian forum: using comments but this isn't ideal as the comments show up in links and other unexpected places. I looked through the documentation/forum/discussions for a better solution but couldn't find one. Any help would be greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 6 replies
-
Hi @benjaminwelch, the best I can suggest with existing code is that when I care about the order of headings in a file, I use the Number Headings Plugin to number my headings, so that the group names then sort naturally. If you are confident with typescript and are willing to experiment with the Obsidian API, you could get the file's headings (as Due to the volume of requests received, I do not have time any more to write custom search instructions for people. However, here is some experimental code as a starting point: group by function \
const taskFileCache = app.metadataCache.getCache(task.file.path); \
const frontMatter = taskFileCache.frontmatter; \
// You would want to get headings instead of frontmatter.....
if (!frontMatter) return 'AAA No front matter'; \
if (frontMatter['tags'] === null) return 'AAA Tags is null'; \
if (frontMatter['tags'] === undefined) return 'AAA Tags is undefined'; \
if (frontMatter['tags'].length === 0) return 'AAA Tags is empty array'; \
if (frontMatter['tags'] === '') return 'AAA Tags is empty string'; \
return frontMatter['tags'] ? frontMatter['tags'] : 'None'; |
Beta Was this translation helpful? Give feedback.
-
This is now possible with a custom grouping instruction, using an undocumented change included in Tasks 7.7.0.
It's undocumented because I'm not yet happy with usability - but there are no plans to change it... So, if you use this and it stops working in future, leave a message here and I'll provide an updated version. |
Beta Was this translation helpful? Give feedback.
This is now possible with a custom grouping instruction, using an undocumented change included in Tasks 7.7.0.
It's undocumented because I'm not yet happy with usability - but there are no plans to change it...
So, if you use this and it stops working in future, leave a message here and I'll provide an updated version.