ivan-lednev / obsidian-task-archiver

Archive completed tasks in your Obsidian vault (plus other org-mode-like features)
MIT License
109 stars 12 forks source link

[Feature request] Add heading information to archived task #33

Closed lukepolak closed 1 year ago

lukepolak commented 1 year ago

Currently, if I have multiple lists separated by headings, when I archive tasks in that page, information about section, in which that task was, is lost. I remember using something like that in sublime sometime ago, and it had this mechanism, that added context to archived elements, one of which was called @project(NAME OF PROJECT). In obsidian, it could be name of the heading, so if I archive something like this:

Test project

It is then archived to this:

Is this something within scope of this plugin or am I overextending it's functionality? :)

ivan-lednev commented 1 year ago

Hi, @lukepolak. Thank you for your input! I've added the {{heading}} placeholder in the latest version. This is how you can achieve the behavior you described: image

lukepolak commented 1 year ago

That was fast :D Thanks a lot, great project :)

bennotkin commented 1 year ago

I'm very impressed by the speed this was resolved with! I wanted this feature, saw lukepolak's feature request, liked it, and it was implemented!

As you continue to develop this, it would be great to have access to multiple levels of headings – either by requesting a certain heading level or by going up the chain (e.g. {{heading-3}} or {{^heading}}

ivan-lednev commented 1 year ago

Hi, @bennotkin,

Could you describe the use case here? Perhaps this will help me come up with a solution.

Requesting a certain heading level is tricky, since it would require some fallback for the case when there are no headings at this level.

Creating something like a {{headingChain}} is more straightforward:

# Heading 1
## Heading 2
### Heading 3

- [x] task

Will turn into

# Archived

- [x] task (Heading 1 > Heading 2 > Heading 3)
bennotkin commented 1 year ago

A heading chain would probably be ideal.

An example use case: a person works on multiple teams with multiple projects, and they organize their tasks as follows.

# Team 1
## Project A
- [x] Task 1
- [ ] Task 2
- [ ] Task 3
## Project B
- [ ] Task 1
- [ ] Task 2
# Team 2
## Project A
- [ ] Task 1
- [x] Task 2
- [ ] Task 3
## Project B
- [x] Task 1
- [ ] Task 2

Would yield something akin to

# Archived
- [x] Task 1 (Team 1 > Project A)
- [x] Task 2 (Team 2 > Project A)
- [x] Task 1 (Team 2 > Project B)

or

# Archived
- [x] Team 1 > Project A: Task 1
- [x] Team 2 > Project A: Task 2
- [x] Team 2 > Project B: Task 1 

These tasks and projects could also be organized into nested lists but then they wouldn't be archived until a the first-order task is complete, but this would be a Team, and would only rarely ever be completed.

Without the heading chain, each task item needs to be worded in a way where it is clear what project and what team it belongs to, even without the context of the headings.

ivan-lednev commented 1 year ago

Hi, @bennotkin,

I added a new placeholder in 0.22.0: image

bennotkin commented 1 year ago

Thank you so much!

bennotkin commented 1 year ago

As I continue to use this (again, thank you so much for your attentiveness and speed, as well as for the tool overall!), I think including the filename (or the the first header in the file) in all the headingChains seems silly when you're archiving to the same file. Obviously it's typically very helpful when archiving to a different file. It'd be nice, in a very low priority way, to either remove the filename from the chain when archiving to the same file, or to make that an option.