obsidian-tasks: Multi-line tasks (indented lines below a task items) are not shown in Reading mode and Tasks query results
Please check that this issue hasn’t been reported before.
- I searched previous Bug Reports didn’t find any similar reports.
Expected Behavior
I have two items, one of them a task item with some lines below it (used Shift-Enter to insert these lines). This results in markdown:
- [ ] first line
second line
and so one
- not the same behavior for a normal item
with some more lines
and another line
The lines below the task item are not shown in read-mode. Rendering as
in edit mode it looks like
This happens only, when the task plugin is enabled.
See also: https://forum.obsidian.md/t/lines-below-task-item-not-visible/61807
Current behaviour
Lines are hidden.
Steps to reproduce
- Setup empty vault
- Paste markdown snippet from above
- Look (edit: in Reading mode)
- Install and enable task plugin
- Restart
- Look again (edit: in Reading mode)
Which Operating Systems are you using?
- Android
- iPhone/iPad
- Linux
- macOS
- Windows
Obsidian Version
1.3.5
Tasks Plugin Version
4.0.0
Checks
- I have tried it with all other plugins disabled and the error still occurs
Possible solution
No response
About this issue
- Original URL
- State: open
- Created 3 years ago
- Reactions: 10
- Comments: 26
Commits related to this issue
- test: Add test data to visualise Obsidian's multi-line task handling This will be useful if working on #2061. — committed to obsidian-tasks-group/obsidian-tasks by claremacrae 2 years ago
- test: Add test data from #3344 - for when #2061 is worked on — committed to obsidian-tasks-group/obsidian-tasks by claremacrae 2 years ago
As a case of “two birds with one stone”, would it be possible to consider the following lines of multi-line tasks as part of the description? Then it would be displayed and useable in filters. (I’m willing to contribute to this, if that seems like a reasonable approach.)
Hi @cvincent, many thanks again for your comments above…
Here are my initial ideas…
What the Tasks Reading Mode code does - and where is it?
I have just added JSDocs class descriptions to all the key classes involved in rendering, in this plugin. See https://github.com/obsidian-tasks-group/obsidian-tasks/commit/bf5e65bf161601f4698c3a621d4d62241c9226e7
Is this actually part of a rewrite of the Reading mode rendering?
My initial assumption: incrementally improve
InlineRenderer.tsUntil recently, I had assumed that this issue could be solved by incrementally improving the Reading Mode implementation in Tasks code: InlineRenderer.ts.
My long comment above assumes that
Alternative approach: start afresh with handling Reading Mode
However the list of bugs associated with Reading Mode is long:
InlineRenderer.ts: label:“display: reading mode”And the Obsidian API has changed a lot since
InlineRenderer.tswas written.So I am starting to wonder whether we should take a step back, and explore whether there are ways to:
I honestly do not know which is the best approach - and we should involve @ilandikov in discussions on this.
New tests added since my initial breakdown of this project
I wrote above that we didn’t have tests for any Obsidian code. However since then, we have written a way to visualise how Obsidian interprets Markdown, so we can use that info in tests with confidence:
And we now have tests that the HTML that Tasks generates when rendering task lines:
There is already a file showing how Obsidian parses and stores multi-line task and list items:
Obsidian’s ‘Strict line breaks’ option
I have done some experiments and established the ‘Strict line breaks’ option only changes how Obsidian renders Markdown.
It does not change how it parses Markdown.
That means that once Tasks supports rendering of multi-line tasks, it will need to:
Ideally those would be done in separate steps, to keep the PRs small and easy to reason about.
Hi @thesamim,
Sure, as you can see, this is one of quite a number of Issues and Discussions that is marked as High Priority:
That means I understand the importance of this issue.
And that it is effectively competing with all the other high priority ones.
There are a lot of factors going in to where amongst all those High Priority requests I spend my free time. There are very many more issues than I have time to address - and that will always be true.
I do not need any more comments here to persuade me of the value of doing this.
And as I was saying only on Discord earlier today
So, if this issue gets a bunch of “me-too” posts, it will drop significantly down the priority list and I may even remove the High Priority label from it.
When I say that this is a large body of work, here is the kind of thing that I mean…
tl;dr This isn’t a single-PR change, it’s a series of incremental changes, each of which needs to be safe, and the code on
mainneeds to be releasable throughout the entire process.If anyone is interested in committing to work on this, I would be available to answer questions, and would add links below to the relevant code locations.
Caveat: this is what I came up with, in about an hour of thinking about it. There may be other things I missed.
Requirements to make this change
My personal philosophy is to always review PRs carefully, to be as confident as I can be that changes (by me and others) do not accidentally cause breakages for users.
This means I only accept PRs to Tasks that contain individual changes, and where any refactorings have been made in small, incremental changes.
I need to either:
Exceptions to this are:
Unfortunately any code in Plugins that imports types from Obsidian like Plugin, MetadataCache, Vault… were not written to be unit-tested… so do not have Jest tests in most plugins.
An exception to this is the Projectswhich may give ideas. (Its licence is Apache - I don’t know if that is compatible with Tasks’ MIT licence.)
How to make this change
I see this change a series of PRs, each of which addresses an incremental part of the project.
For example, there could be some initial PRs to:
etc
How to change the Markdown reading and writing code
It would need to make sure that multiline tasks are both:
Storing tasks
Task.ts
Searching tasks
task.originalMarkdownis a documented facility in - Task Properties - so somehow this would need to be maintained, in order to not break user searchesRendering of tasks
Places to consider:
Users interacting with tasks
Testing
User Documentation
Hi @cvincent, many thanks for your kind message. Things have changed a bit with the code since I wrong the long list of steps above, so I will need some time to reply thoroughly, which I plan to do in the next few days.
@claremacrae I was reading through your comment as I am making initial considerations on whether to commit some time to this issue. I appreciate the clear explanation of your process and your deliberate approach.
I have a question. Have you thought about how Tasks would interact with this option in Obsidian?
My use case, for context, is that I do most of my note editing in NeoVim where it is configured to hard-wrap long lines as I’m typing when a line extends beyond a certain column. So in my case, and per the Markdown specs according to the setting description in Obsidian, when this setting is on, single line breaks in a task item should be ignored, and the text instead joined together as though it were on a single line, which happens to be my desired behavior. In this mode, some of the concerns you outlined wouldn’t be an issue at all (e.g., the editor window would not actually need to support multiple lines). But, for this to be a complete feature, as this is a user preference in base Obsidian, the implementation would likely need to understand this setting and do the right thing in both cases.
What are your thoughts? And thank you for this excellent plugin!
I use
<br>to replace\n, and it works for me.For those who want to still a workaround of having a very descriptive task that needs to span multiple lines, an alternative is to basically hyperlink your task.
Sorry for not responding earlier, Clare! I missed the notification and failed to add a “come back to this” to my tasks tracker. 😅 Work also picked up a bit, so I haven’t had as much “learning time” as before.
That’s definitely a larger chunk of work than I would have hoped for, but I completely agree with the philosophy. I’m out of time for looking at things today, but I will try to make time tomorrow for digging into that some.
One of the benefits of multiple PRs could also be more distributed work, with regards to both time and persons. Hopefully others will be able to build on things as well.
@floli I’ve just noticed you’ve pasted the same image link in twice, and it’s not obvious because the image is not shown.
Please kindly edit the report above and paste in the actual images, rather than links to them…
Many thanks.