obsidian-kanban
obsidian-kanban copied to clipboard
[Bug]: Nested tasks/subtasks not being saved as such in markdown
Describe the bug
Basically what the title says. I found this while trying to access tasks and subtasks saved in Kanban via dataviewjs. What I found was dataviewjs not correctly rendering the subtasks as checkboxes but as plain "- [ ]". I went deeper and found the Kanban plugin not saving those nested tasks/subtasks in markdown.
Left: Kanban, Mid: Kanban Markdown mode, Right: Dataviewjs
Expected Behavior
The plugin should reflect the nested tasks/subtasks in markdown.
Steps to reproduce
see Description of the bug.
Relevant errors (if available)
No response
Operating system
Windows
@matt-latt This is a known limitation with the way this plugin stores a cards markdown. In order to allow multi-line cards, the plugin strips out new lines and replaces them with HTML line break tags<br>
. Other plugins likely won't be able to correctly recognize these, unfortunately
@mgmeyers I poked at this a bit, and it seems like if there are leading spaces, the AST will parse multiple lines into the same list item.
So e.g.
- [ ] Item
second line
third line
will be parsed such that the listItem contains a paragraph with all three lines (this matches what Obsidian does in reading mode, too).
With this in mind, I modified the code to insert leading spaces instead of <br>
tags, and it seems to work.
Here is what it looks like in Kanban mode:
And here is what it looks like in markdown mode:
I know you marked this as wontfix, but maybe it's worth reconsidering? I'd be happy to help out with a PR. From the bit of testing I've done, my changes don't break any of the core functionality (adding/moving/deleting cards), but I'm a new user so I haven't tested this with all of the features.
This might be related.
@naitian I have managed to implement your workaround, which is awesome. Thank you for sharing!
I have one request. Do you have a fix for the extra brackets that form when linking the card to a note?
Kanban mode:
Source mode:
@naitian would you consider making a pull request? Or does this implementation have issues not present in the current imp?