obsidian-tasks icon indicating copy to clipboard operation
obsidian-tasks copied to clipboard

Numbered sub-tasks aren't rendered in reader mode

Open BrianKmdy opened this issue 2 years ago β€’ 18 comments
trafficstars

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

edit-mode

Reader mode

read-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

BrianKmdy avatar Dec 13 '22 05:12 BrianKmdy

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?

claremacrae avatar Dec 13 '22 08:12 claremacrae

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

claremacrae avatar Dec 13 '22 08:12 claremacrae

I wonder if this relates to #372.

claremacrae avatar Dec 13 '22 08:12 claremacrae

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:

  1. Change InlineRenderer to also display nested numbered tasks.
  2. Change InlineRenderer to also display all lines nested in tasks.

I strongly prefer 2, and hope that it may possibly be easier.

claremacrae avatar Dec 13 '22 08:12 claremacrae

@schemar If you have time, please could you have a look at the above and share any thoughts? Many thanks!

claremacrae avatar Dec 13 '22 08:12 claremacrae

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.

claremacrae avatar Dec 13 '22 09:12 claremacrae

@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...).

schemar avatar Dec 13 '22 09:12 schemar

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 avatar Dec 13 '22 10:12 claremacrae

@claremacrae I edited the issue to add the markdown I used for testing

BrianKmdy avatar Dec 13 '22 17:12 BrianKmdy

Thanks!

claremacrae avatar Dec 13 '22 19:12 claremacrae

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.

MadaboutDana avatar Dec 16 '22 22:12 MadaboutDana

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.

claremacrae avatar Dec 16 '22 23:12 claremacrae

Yes, sure. I'll sort that out later today. Cheers!

MadaboutDana avatar Dec 17 '22 16:12 MadaboutDana

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.

claremacrae avatar Dec 21 '22 22:12 claremacrae

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.

BrianKmdy avatar Dec 22 '22 00:12 BrianKmdy

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...

claremacrae avatar Dec 22 '22 08:12 claremacrae

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
image image

xt0rted avatar Sep 11 '23 21:09 xt0rted

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:

image

I've saved the rendered HTML:

Here is a screenshot of the difference between those two files:

image

The technique I used to save the HTML is described in the following, except that I selected a larger chunk of HTML: image

claremacrae avatar Mar 08 '24 09:03 claremacrae

The fix for this is now released in Tasks 7.8.0.

claremacrae avatar Aug 12 '24 18:08 claremacrae