Skip to content

Commit a5c1612

Browse files
committed
docs: Show 'group by function' inheriting tags from parent task
Fixes #3647
1 parent 683350b commit a5c1612

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

docs/Queries/Grouping.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,17 @@ group by function task.tags.filter( (tag) => ! tag.includes("#tag") )
754754

755755
- Create headings for all tags that do not contain "#tag".
756756

757+
```javascript
758+
group by function \
759+
if (task.tags.length > 0) return task.tags; \
760+
return task.findClosestParentTask()?.tags ?? [];
761+
```
762+
763+
- Group tag-less child tasks by any tags on their parent task:
764+
- If the task has any tags on its own line, then group by those tags.
765+
- Otherwise, look for the first parent task, and group by its tags.
766+
- If there is no parent task, treat the tags as empty.
767+
757768
<!-- placeholder to force blank line after included text --><!-- endInclude -->
758769

759770
These are more complicated examples, which you might like to copy if you use tasks with [nested tags](https://help.obsidian.md/Editing+and+formatting/Tags#Nested+tags) and wish to group them at different tag nesting levels.

0 commit comments

Comments
 (0)