obsidian-tasks
obsidian-tasks copied to clipboard
Numbered sub-tasks aren't rendered in reader mode
Please check that this issue hasn't been reported before.
- [X] I searched previous Bug Reports didn't find any similar reports.
Expected Behavior
I just realized this while using the latest release after the PR I submitted (https://github.com/obsidian-tasks-group/obsidian-tasks/pull/1363). It looks like sub-tasks in numbered task lists aren't being rendered in reader mode.
The expected behavior is that a numbered task list with sub tasks would have all the same items in read and edit mode.
Current behaviour
When you switch to reader mode the sub tasks of numbered task-lists are no longer getting rendered. This only affects numbered task-lists. Bullet point task lists and regular numbered lists are unaffected.
Edit mode

Reader mode

Steps to reproduce
To reproduce just create a numbered task list with sub-tasks and switch to reader mode. Here's the markdown I used for testing:
### Bullet point to-do list
- [ ] Bullet 1
- [ ] Sub bullet 1
- [ ] Bullet 2
- [ ] Bullet 3
### Numbered to-do list
1. [ ] Task 1
1. [ ] Sub task 1
2. [ ] Task 2
3. [ ] Task 3
### Regular numbered list
1. Item 1
1. Sub item 1
2. Item 2
3. Item 3
Which Operating Systems are you using?
- [ ] Android
- [ ] iPhone/iPad
- [ ] Linux
- [ ] macOS
- [X] Windows
Obsidian Version
1.0.3
Tasks Plugin Version
1.20.0
Checks
- [X] I have tried it with all other plugins disabled and the error still occurs
Possible solution
No response
Hi @BrianKmdy Thanks ever so much fo reporting this.
When you have time, please could you paste in the mark-down used in your images, to save time for whoever works on this?
I won't have time to look at this for a few days, so in case anyone else has time to look at it, I believe that these are the interesting code locations, as of 1.20.0 tag.
InlineRenderer.ts- https://github.com/obsidian-tasks-group/obsidian-tasks/blob/1.20.0/src/InlineRenderer.ts
- Which calls Task.toLI()
- https://github.com/obsidian-tasks-group/obsidian-tasks/blob/1.20.0/src/Task.ts#L448
I wonder if this relates to #372.
Also possible related: #1041 Tasks doesn't show indented non-tasks in Reading mode. I suspect that it thinks that the numbered items are non-tasks for some reason.
Options for (trying to fix display of numbered sub-tasks:
- Change
InlineRendererto also display nested numbered tasks. - Change
InlineRendererto also display all lines nested in tasks.
I strongly prefer 2, and hope that it may possibly be easier.
@schemar If you have time, please could you have a look at the above and share any thoughts? Many thanks!
I believe that the purpose of InlineRenderer is to ensure that when a user completes a task in Reading mode, the done emoji and date is added, and if the task is recurring, the new instance is added.
If that is correct, I wonder whether the event-based approach described in #1389 might be a way to achieve the same end without needing to futz with rendering in Reading mode?
If so, this would make a whole load of reported issues disappear.
@schemar If you have time, please could you have a look at the above and share any thoughts? Many thanks!
Tasks was never meant to support "numbered tasks". Properly enabling numbered tasks would require quite some changes, I believe.
If I recall correctly, "numbered task lists" are not a native markdown feature and were added by Obsidian later. For example: this markdown guide doesn't even list numbered tasks: https://www.markdownguide.org/tools/obsidian/
However, since it is part of Obsidian, Tasks should probably support this? I am not sure what exactly would need to change, though. I would look at the cache class which gathers the tasks and at the toLi method which renders the task (as you already wrote above).
Since rendering in reader mode is an ongoing issue, you may consider changing the code so that the inline stuff doesn't get re-rendered. Though that's a bigger change, if I recall correctly. And you may lose some other features like styling if you do that (maybe not...).
Hi @schemar,
Yes, your summary of numbered task lists is correct.
The recent 1.20.0 release added support for searching of "numbered tasks". They are intentionally rendered just as bullet lists in search results, and this is documented (in the 3rd warning here: https://obsidian-tasks-group.github.io/obsidian-tasks/getting-started/#limitations-and-warnings)
I'm not expecting you to review all these, but for info, the changes that made this possible are:
- #1006
- #1363
- Implemented by @BrianKmdy , who logged this issue.
- #1388
- #1390
- #1391
- Fixed #1371
- #1392
Since rendering in reader mode is an ongoing issue, you may consider changing the code so that the inline stuff doesn't get re-rendered. Though that's a bigger change, if I recall correctly. And you may lose some other features like styling if you do that (maybe not...).
That's a good point. #877 is being worked on, to add more CSS options - and I just looked to see if the current progress changed InlineRenderer. Luckily, it only adds (very helpful) comments so far:
https://github.com/obsidian-tasks-group/obsidian-tasks/compare/main...esm7:obsidian-tasks:feat-themeability
So it does more than just the adding a click-handler, it can hide the global filter too. And maybe other stuff,
@claremacrae I edited the issue to add the markdown I used for testing
Thanks!
Just to confirm that I'm finding the same issue with subitems in task lists, too βΒ in reading mode, there's no indication that a list is folded, nor is it possible to unfold the list. The same applies to task lists with subtasks, and to text items with sublists (tasks or bullets). Tasks appears to nuke the icons/markers indicating folded or foldable lists. If the list is already unfolded, there's no touch-based way to fold it (although you can use the fold/unfold commands).
I've restarted Obsidian and disabled/re-enabled Tasks multiple times to double-check this issue.
Hi @MadaboutDana,
Your description sounds like it is touching on multiple other issues. I think they are all known, but just in case not, I would like to investigate.
So please could you start a new Q&A Discussion, and paste in as plain text some example tasks, and a screenshot showing how they are rendered for you in reading mode.
Please note any other relevant info, such as your current Tasks version, platform you are running on.
Thanks in advance.
Yes, sure. I'll sort that out later today. Cheers!
I would appreciate help on this. If anyone is interested in working on this, I would be happy to talk you through the relevant code and help you get started.
I can try and work on it over the holidays @claremacrae. I would definitely be interested in learning more about the relevant code since I'm not too familiar with this codebase yet.
I can try and work on it over the holidays @claremacrae. I would definitely be interested in learning more about the relevant code since I'm not too familiar with this codebase yet.
Hi @BrianKmdy - great, thank you!
I was thinking that now that Canvas is open to all, I could try drawing a diagram or few about key parts of the Tasks source code.
In the meantime, feel free to email me (address in GitHub profile) to find a time we can both make...
I'm seeing this in Obsidian 1.4.10 and Tasks 4.6.1 with even simpler markdown:
- [ ] Item 1
- Item a
- Item b
- [ ] Item 2
1. Item a
1. Item b
| Plugin enabled | Plugin disabled |
|---|---|
I just did an experiment to see how Tasks changes the HTML rendering.
This is the markdown file I used:
- [ ] Item 1 π
2024-03-08
- Item a π
2024-03-08
- Item b π
2024-03-08
- [ ] Item 2 π
2024-03-08
1. Item a π
2024-03-08
1. Item b π
2024-03-08
1. [ ] Item c π
2024-03-08
1. [ ] Item d π
2024-03-08
And this is what Tasks does to the appearance:
I've saved the rendered HTML:
- Without Tasks enabled, the HTML is:
- With Tasks enabled, the HTML is:
Here is a screenshot of the difference between those two files:
The technique I used to save the HTML is described in the following, except that I selected a larger chunk of HTML:
The fix for this is now released in Tasks 7.8.0.