xhuajin / obsidian-tabs

MIT License
57 stars 2 forks source link

Issue when creating a task out of a Tasks request but in a tabs. #22

Open NoahBoos opened 1 month ago

NoahBoos commented 1 month ago

Hello, new issue about Tasks in Tabs, when you create a Tasks in a tab that is provided by Tabs, the created tasks isn't supported and isn't query-able in Tasks query.

If the codeblock is that :

tab: test
- [ ] Passer l'aspirateur dans ma chambre.  [created:: 2024-07-14]  [start:: 2024-07-14]  [scheduled:: 2024-07-14]  [due:: 2024-07-14]
- [ ] Passer l'aspirateur dans la maison, en général.  [created:: 2024-07-14]  [start:: 2024-07-14]  [scheduled:: 2024-07-14]  [due:: 2024-07-14]
- [ ] Rattraper le retard des tâches.  [created:: 2024-07-14]  [start:: 2024-07-14]  [scheduled:: 2024-07-14]  [due:: 2024-07-14]

The output will be the following image. image

BUT ! When you'll try to query it, it won't spawn. If the Tasks request is :

tab: À finir
```tasks
hide due date
hide done date
hide scheduled date
hide start date
hide created date
hide cancelled date
hide priority
short mode
sort by due
filter by function ! task.isDone
due 2024-07-14


It should works because the due date entered as filter in the Tasks query is the same as the due date of the Tasks we just created in the above example. The problem is that... Well, this is the render :

![image](https://github.com/user-attachments/assets/ec84d88a-e2cb-4990-8ecb-d1c0e1bc9bc7)

I think the issue may be from the fact that Tabs is functioning using Codeblock so, the syntax to build and manage tasks is parsed like a plain text, not like a task.
claremacrae commented 1 month ago

Hi, Tasks maintainer here....

The Tasks plugin gets its list of tasks from Obsidian's CachedMetadata - from the ListItemCache.

I think that you are saying that you have put some task lines inside a Tabs code block, and Tasks is not reading them.

If so, then this is the expected behaviour.

Obsidian does not parse lines inside any code block as list items, so no plugin that uses the ListItemCache will see task lines in any code blocks.

Perhaps the docs for this plugin should say tell people not to put any content in tabs that they want to be accessible by other plugins....

xhuajin commented 1 month ago

Thanks for your explanation. I'll add it to the docs in next commit.

claremacrae commented 1 month ago

I noticed now that @NoahBoos was exactly correct:

I think the issue may be from the fact that Tabs is functioning using Codeblock so, the syntax to build and manage tasks is parsed like a plain text, not like a task.

NoahBoos commented 1 month ago

Obsidian does not parse lines inside any code block as list items, so no plugin that uses the ListItemCache will see task lines in any code blocks.

There is no way to change that, so ? Am I wrong ?

claremacrae commented 1 month ago

Correct. As far as I know, there is no way to change that.

claremacrae commented 1 month ago

There is a workaround though. I haven’t tested it (am on mobile and with no time to spare) but it will probably work.

  1. Put your tasks in an ordinary file markdown file
  2. Embed that file, or section of that file, in the Tabs section with: ![[File containing tasks]]

I suspect you will be able to interact with the tasks normally via the embed, such as completing them and getting a Done date added.

Please test and confirm, @NoahBoos.