Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions dwertheimer.TaskSorting/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,18 @@

See Plugin [README](https://github.com/NotePlan/plugins/blob/main/dwertheimer.TaskSorting/README.md) for details on available commands and use case.

## [1.2.6] - 2025-09-23 (@dwertheimer)

- Add logging for jgclark to sortTasksUnderHeading
- Add ability to pass all params to /ts and /tsh commands
- remove sortTasksViaTemplate code which was never a published command
- change default behavior of /ts* commands to interleave task types (open/checklist together)
- **NEW**: Add `sortInHeadings` parameter to `/ts` command to override DataStore setting
- `sortInHeadings: false` treats entire note as one unit (moves all open tasks to top)
- `sortInHeadings: true` sorts tasks within each heading separately (default behavior)
- Allows x-callback-url calls to specify sorting behavior regardless of user's DataStore settings
- Fix bug where tasks were not being sorted in headings for frontmatter-only notes

## [1.2.4] - 2025-08-31 (@dwertheimer)

- Add saveEditorIfNecessary() to all commands
Expand Down
56 changes: 56 additions & 0 deletions dwertheimer.TaskSorting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,33 @@ This plugin will sort your tasks in the open note in the Editor interactively so

When you run /ts, it will sort the tasks into task types (open|scheduled|completed|cancelled), and it will ask you how you want to sort within those categories and whether you want the output to have the category type headings or not, e.g.:

#### Parameters (for x-callback-url calls):
- `arg0`: `withUserInput` (true/false) - whether to prompt user interactively
- `arg1`: `sortFields` (comma-separated string) - sort order, e.g. "-priority,content"
- `arg2`: `withHeadings` (true/false) - whether to output section headings like "Open Tasks"
- `arg3`: `subHeadingCategory` (true/false) - whether to output subheadings for each tag/mention
- `arg4`: `interleaveTaskTypes` (true/false) - whether to interleave task types together or keep separate
- `arg5`: `sortInHeadings` (true/false) - whether to sort within each heading separately or treat entire note as one unit

#### Examples:
```text
# Sort by priority without headings, treating entire note as one unit (moves all open tasks to top)
noteplan://x-callback-url/runPlugin?pluginID=dwertheimer.TaskSorting&command=Sort%20tasks%20on%20the%20page&arg0=false&arg1=-priority,content&arg2=false&arg3=false&arg4=true&arg5=false

# Sort within each heading separately (default behavior)
noteplan://x-callback-url/runPlugin?pluginID=dwertheimer.TaskSorting&command=Sort%20tasks%20on%20the%20page&arg0=false&arg1=-priority,content&arg2=false&arg3=false&arg4=true&arg5=true
```

**New Feature: Task Type Interleaving (Default Behavior)**
- **By default**, tasks are interleaved: compatible task types are combined and sorted together by priority
- Within each priority level, open tasks appear before checklists
- This allows tasks to be sorted by priority first, then by type (open before checklist)

**Sorting Behavior Options:**
- **`sortInHeadings: true`** (default): Sort tasks within each heading separately. Tasks stay under their original headings but are sorted within each heading.
- **`sortInHeadings: false`**: Treat the entire note as one unit. All open tasks move to the top of the page regardless of which heading they were originally under.
- To use traditional grouping (all open tasks together, then all checklists together), set `interleaveTaskTypes=false`

```text
#### Open Tasks
- [ ] Open Task
Expand Down Expand Up @@ -79,6 +106,35 @@ For example, this command will sort all the tasks under the heading "Open Tasks"
noteplan://x-callback-url/runPlugin?pluginID=dwertheimer.TaskSorting&command=Sort%20tasks%20under%20heading%20%28choose%29&arg0=Open%20Tasks&arg1=%5B%22-priority%22%2C%22content%22%5D
```

### X-Callback URL Examples

**Sort tasks with interleaving (default behavior):**
```
noteplan://x-callback-url/runPlugin?pluginID=dwertheimer.TaskSorting&command=Sort%20tasks%20on%20the%20page&arg0=false&arg1=-priority%2Ccontent&arg2=false&arg3=false&arg4=true
```

**Sort tasks with traditional grouping (override default):**
```
noteplan://x-callback-url/runPlugin?pluginID=dwertheimer.TaskSorting&command=Sort%20tasks%20on%20the%20page&arg0=false&arg1=-priority%2Ccontent&arg2=false&arg3=false&arg4=false
```

**Sort tasks under heading with interleaving (default):**
```
noteplan://x-callback-url/runPlugin?pluginID=dwertheimer.TaskSorting&command=Sort%20tasks%20under%20heading%20%28choose%29&arg0=Open%20Tasks&arg1=%5B%22-priority%22%2C%22content%22%5D&arg2=null&arg3=true
```

**Sort tasks under heading with traditional grouping:**
```
noteplan://x-callback-url/runPlugin?pluginID=dwertheimer.TaskSorting&command=Sort%20tasks%20under%20heading%20%28choose%29&arg0=Open%20Tasks&arg1=%5B%22-priority%22%2C%22content%22%5D&arg2=null&arg3=false
```

**Parameters explained:**
- `arg0`: withUserInput (false = no prompts)
- `arg1`: sortFields (comma-separated: "-priority,content")
- `arg2`: withHeadings (false = no type headings)
- `arg3`: subHeadingCategory (false = no subheadings)
- `arg4`: interleaveTaskTypes (true = interleave by priority, false = traditional grouping by type)

> **NOTE**: If you are calling this command from a plugin or a template and want to sort tasks under a heading in a specific note (or the Editor) you have been working on, you **should** pass the note as a third parameter to ensure that taskSorting is working on the same Object you have been working on, e.g. ("myHeading",["-priority","content"], Editor). For clarity, Task Sorting plugin works on **Editor.note**, but if you are using Editor (and not Note) you should pass Editor in as the noteOverride parameter, else the delayed write from Editor will overwrite any task sorting you do.

## Task Sorting Notes
Expand Down
Loading
Loading