Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Numbered sub-tasks aren't rendered in reader mode #1395

Open
3 of 7 tasks
BrianKmdy opened this issue Dec 13, 2022 · 18 comments
Open
3 of 7 tasks

Numbered sub-tasks aren't rendered in reader mode #1395

BrianKmdy opened this issue Dec 13, 2022 · 18 comments
Labels
display: reading mode Issues referring to Obsidian's Reading Mode or Reading View priority: high A high priority/important request scope: rendering of tasks How the plugin displays tasks (except CSS issues) scope: sub-tasks and super-tasks Indenting tasks, nesting tasks, controlling their display, filtering them, and similar things type: bug Something isn't working

Comments

@BrianKmdy
Copy link
Contributor

BrianKmdy commented Dec 13, 2022

Please check that this issue hasn't been reported before.

  • 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 (#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
  • Windows

Obsidian Version

1.0.3

Tasks Plugin Version

1.20.0

Checks

  • I have tried it with all other plugins disabled and the error still occurs

Possible solution

No response

@BrianKmdy BrianKmdy added the type: bug Something isn't working label Dec 13, 2022
@claremacrae
Copy link
Collaborator

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
Copy link
Collaborator

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.

@claremacrae
Copy link
Collaborator

claremacrae commented Dec 13, 2022

I wonder if this relates to #372.

@claremacrae
Copy link
Collaborator

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
Copy link
Collaborator

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

@claremacrae claremacrae added the scope: rendering of tasks How the plugin displays tasks (except CSS issues) label Dec 13, 2022
@claremacrae
Copy link
Collaborator

claremacrae commented Dec 13, 2022

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
Copy link
Collaborator

schemar commented Dec 13, 2022

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

@claremacrae
Copy link
Collaborator

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:

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:

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,

@BrianKmdy
Copy link
Contributor Author

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

@claremacrae
Copy link
Collaborator

Thanks!

@MadaboutDana
Copy link

MadaboutDana commented Dec 16, 2022

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.

@claremacrae
Copy link
Collaborator

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.

@MadaboutDana
Copy link

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

@claremacrae claremacrae added the help wanted Extra attention is needed label Dec 21, 2022
@claremacrae
Copy link
Collaborator

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.

@BrianKmdy
Copy link
Contributor Author

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.

@claremacrae
Copy link
Collaborator

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 claremacrae mentioned this issue Jan 25, 2023
7 tasks
@claremacrae claremacrae added the scope: sub-tasks and super-tasks Indenting tasks, nesting tasks, controlling their display, filtering them, and similar things label Feb 4, 2023
@xt0rted
Copy link

xt0rted commented Sep 11, 2023

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

@claremacrae claremacrae added the display: reading mode Issues referring to Obsidian's Reading Mode or Reading View label Oct 9, 2023
@claremacrae
Copy link
Collaborator

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 claremacrae removed the help wanted Extra attention is needed label Jun 3, 2024
@claremacrae claremacrae added the priority: high A high priority/important request label Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
display: reading mode Issues referring to Obsidian's Reading Mode or Reading View priority: high A high priority/important request scope: rendering of tasks How the plugin displays tasks (except CSS issues) scope: sub-tasks and super-tasks Indenting tasks, nesting tasks, controlling their display, filtering them, and similar things type: bug Something isn't working
Projects
Status: 🔖 Ready
Development

No branches or pull requests

5 participants