Skip to content

Commit af82ba2

Browse files
authored
Merge pull request #3146 from obsidian-tasks-group/show-tree-docs
docs: Document the show and hide tree instructions
2 parents 3f73e96 + cd1c255 commit af82ba2

File tree

3 files changed

+62
-2
lines changed

3 files changed

+62
-2
lines changed

docs/Queries/Layout.md

Lines changed: 60 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ hide created date
6161

6262
The following query elements exist:
6363

64+
- `tree`
6465
- `edit button`
6566
- `postpone button`
6667
- `backlink`
@@ -70,16 +71,73 @@ The following query elements exist:
7071
> [!released]
7172
>
7273
> - `urgency` was introduced in Tasks 1.14.0.
74+
> - `tree` was introduced in Tasks X.Y.Z.
7375
74-
All of these query elements except `urgency` are shown by default, so you will use the command `hide`
75-
if you do not want to show any of them, or the command `show` to show the urgency score.
76+
All of these query elements except `urgency` and `tree` are shown by default, so you will use the command `hide`
77+
if you do not want to show any of them, or the command `show` to show the urgency score or tree view.
7678

7779
For example:
7880

7981
```text
8082
hide task count
8183
```
8284

85+
### Hide and Show Tree
86+
87+
> [!Tip]
88+
> The new instruction `show tree` is the first in a long series of steps to teach the Tasks plugin to fully handle [nested tasks and list items](https://help.obsidian.md/Editing+and+formatting/Basic+formatting+syntax#Nesting+lists).
89+
>
90+
> When you use `show tree`, Tasks shows all found tasks, and **all** their nested tasks and list items (for now, regardless of whether or not the nested tasks matched the query).
91+
92+
#### Show Tree example
93+
94+
Suppose you have a note called `Party Planner`, with the following list:
95+
96+
```text
97+
- [ ] Have a party
98+
- Planning
99+
- [x] Decide who to invite ✅ 2024-10-26
100+
- [ ] Send out the invites
101+
- Preparation
102+
- [ ] Plan the menu
103+
- **Remember Sam's dietary requests**
104+
- [ ] Buy the food
105+
- On the day
106+
- [ ] Prepare the food
107+
- [ ] Tidy up
108+
```
109+
110+
And you have this Tasks query:
111+
112+
````text
113+
```tasks
114+
not done
115+
filename includes Party Planner
116+
117+
show tree
118+
hide backlink
119+
```
120+
````
121+
122+
The `show tree` instruction enables us to see the parent/child relationships in the tasks, and their nested tasks and list items:
123+
124+
![Sample search results with 'show tree' instruction](../images/show-tree.png)
125+
<span class="caption">Sample search results with 'show tree' instruction</span>
126+
127+
#### How Show Tree works
128+
129+
> [!warning]
130+
> If using `show tree`, please be aware of its current behaviour, detailed below.
131+
>
132+
> We are releasing this first version, having found to already be valuable in our own vaults.
133+
134+
- For now, **all child tasks and list items are displayed**, regardless of whether they match the query.
135+
- In the screenshot above, `Decide who to invite` did not match the `not done` query, but it is still shown.
136+
- Any **sorting instructions only affect the sorting of the left-most tasks** in the results list.
137+
- Child tasks and list items are displayed in the order that they appear in the file. They are not affected by any `sort by` instructions.
138+
- For now, the **tree layout is turned off by default**, whilst we explore how it should interact with the filtering instructions.
139+
- We hope to make it the default behaviour in a future release.
140+
83141
## Example of show and hide
84142

85143
Multiple show and hide instructions can be used in a query, each on a separate line.

docs/What is New/Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ _In recent [Tasks releases](https://github.com/obsidian-tasks-group/obsidian-tas
1212

1313
## 7.x releases
1414

15+
- X.Y.Z:
16+
- Add [[Layout#Hide and Show Tree|display of nested tasks]] in search results, with `show tree`
1517
- 7.11.0:
1618
- Add [[Sorting#Random sorting|random sorting]], with `sort by random`
1719
- 7.10.0:

docs/images/show-tree.png

28.4 KB
Loading

0 commit comments

Comments
 (0)