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

[Bug]: Nested tasks/subtasks not being saved as such in markdown

Open matt-latt opened this issue 2 years ago • 5 comments

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

awholelottatasks

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 avatar Jul 01 '22 06:07 matt-latt

@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 avatar Sep 17 '22 18:09 mgmeyers

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

And here is what it looks like in markdown mode: image

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.

naitian avatar Jan 05 '23 04:01 naitian

This might be related.

dictionarymouse avatar Apr 13 '23 20:04 dictionarymouse

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

Source mode: image

msulwa avatar Aug 23 '23 10:08 msulwa

@naitian would you consider making a pull request? Or does this implementation have issues not present in the current imp?

NoahKamara avatar Oct 29 '23 12:10 NoahKamara