obsidian-toggle-list icon indicating copy to clipboard operation
obsidian-toggle-list copied to clipboard

Feature Request: more flexibility to define transitions

Open hmijail opened this issue 10 months ago • 4 comments

Background

Imagine we have a task with a created date, thanks to ToggleList:

- [ ] My task ➕ 2024-01-01

When we use ToggleList again to cycle the task status to "done", the existing date is removed and a new one is added:

- [x] My task  ✅ 2024-04-29

There is no way to define next states like these with a single hotkey:

- [/] My task ➕ 2024-01-01

(note the [/] checkbox)

- [x] My task  ➕ 2024-01-01 ✅ 2024-04-29

Even if we define multiple cycles and hotkeys, for example one to add the creation date ➕ and another to add the finished date ✅, cycling through any of them will remove the corresponding date and re-add today's date (instead of the original one). So going through a cycle causes the existing date to be lost.

Feature Request

It would be great to have a few changes to be able to accomplish these transitions with a single hotkey.

  • Allow each state group to be non-cyclical: once the end of the group is reached, that group doesn't evolve further and allows other groups to match. This would allow to have multiple groups assigned to a single hotkey, such that e.g. the creation date group gets stuck when a ➕ is in the line, and then the finished date group can take over to add the ✅.
  • Allow greater control over what is matched and what is changed in each transition. Currently, the format {time:: YYYY-MM-DD} is used both for matching (so that YYYY-MM-DD is any date) and for adding today's date in the given format. It would be much more flexible to e.g. use grep patterns with subgroups for replacement, where in the replacement we could also add the {time} variable. For example, to finish a task and add to it a finished date while respecting the existing creation date: match: - [ ] (.* ➕[\d-]) replace: - [x] \1 ✅ {time:: YYYY-MM-DD}

hmijail avatar Apr 30 '24 09:04 hmijail