[Bug?] [Question] Append command to heading
Boonthrall opened this issue · 2 comments
Okay so i'm kind of at my wits end.
Resources
- (Plugin) Advanced URI v1.38.1
- (Plugin) Tasks v4.8.1
- (Plugin) Buttons v0.4.19
- (Plugin) Periodic Notes v0.0.17
Scenario / What i want
I'd like to add a button/shortcut inside of obsidian to quickly add tasks to my daily note under a certain heading.
To add a task I'd like to execute the Task Command that opens a Modal and inserts the created task at the current line.
Preferably directly under the heading but it's also fine if it appends to the end of that heading section.
URI Versions
According to Command URI documentation
obsidian://advanced-uri?vault=Regular%20planning&commandid=obsidian-tasks-plugin%253Aedit-task&daily=true&heading=ToDo&mode=append
Other attempts
obsidian://advanced-uri?vault=Regular%20planning&commandid=obsidian-tasks-plugin%253Aedit-task&mode=append&daily=true&heading=ToDo
obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo&commandid=obsidian-tasks-plugin%253Aedit-task&mode=append
I have tried several other combinations but don't plan on posting them all.
Expected behaviour
- Open the current daily note
- Move the cursor to a new line under the header or at the end of the header section
- Execute Create Task command
- Create and add task to file (But Advanced URI has no role in this step)
Current behaviour
If a heading is specified AND a mode is specified (append/prepend) the heading parametee gets ignored and the cursor moved to the end/beginning of the file
But everything else works as expected/intended
Other notes
I'm most likely just doing something wrong, but I can't for the life of me figure out what.
So sorry for that.
So when you omit the mode
, but keep the heading
parameter, the task gets inserted at the beginning of the heading, right?
Okay, seems like i got my notes fumbled, sorry!
Also sorry for the late reply, the week suddenly got very busy.
With further testing, this is the current behaviour of different parts of the URI.
1)Remove mode
URI
obsidian://advanced-uri?vault=Regular%20planning&commandid=obsidian-tasks-plugin%253Aedit-task&daily=true&heading=ToDo
Expectation
- Open the current daily note
- Move directly under the "ToDo"-Heading
- Execute the command
Result ❌
Doesn't work as expected
- Opens the current daily note
- Moves the cursor to the first line in the note (or rather doesn't move the cursor at all, as such it's on the first line) not sure if to the beginning or end of the line
- Executes the command
2)Move Note and Heading parameters
URI
Variant 1
obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo&commandid=obsidian-tasks-plugin%253Aedit-task
Variant 2 (with mode=append
)
obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo&mode=append&commandid=obsidian-tasks-plugin%253Aedit-task
Expectation
- Open the current daily note
- Move the cursor directly under the "ToDo"-Heading or with variant 2 at the end of the section
- Execute the command
Result ❌
Doesn't work as expected
- Opens the current daily note
- [Variant 1] Moves the cursor to the first line in the note (or rather doesn't move the cursor at all, as such it's on the first line) not sure if to the beginning or end of the line
- [Variant 2] Moves the cursor to the end of the note
- Executes the command
3)Remove command parameter
URI
obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo
Expectation
- Open the current daily note
- Move the cursor to the "ToDo"-Heading
Result ✅
Works as expected
4)Use a different command
URI
obsidian://advanced-uri?vault=Regular%20planning&daily=true&heading=ToDo&commandid=editor%253Aset-heading-2
Expectation
- Open the current daily note
- Move the cursor directly under the heading
- Execute the command
Result ✅
Works as expected
5)Use a different command that also opens a modal/dialog
URI
obsidian://advanced-uri?vault=Regular%20planning&commandid=buttons%253Abutton-maker&daily=true&heading=ToDo
Expectation
- Open the current daily note
- Move the cursor directly under the heading
- Execute the command
Result ❌
Doesn't work as expected
- Opens the current daily note
- Moves the cursor to the first line in the note (or rather doesn't move the cursor at all, as such it's on the first line) not sure if to the beginning or end of the line
- Using
mode
results in the cursor being placed at the end of the note