# Sub-tasks in tasks lists are not correctly identified by Obsidian

**URL:** <https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820>\
**Category:** Bug graveyard\
**Created:** [February 11, 2021, 3:03pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820 "2021-02-11T15:03:16Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 11, 2021, 3:03pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/1 "2021-02-11T15:03:16Z")

</div>

Testing some custom CSS snippets to make my edition experience better, I discovered a bug in the way sub-tasks are managed by Obsidian editor.

### Steps to reproduce

Create a list of tasks:

- [] task 1
- [] task 2
- [] task 3  
Then, insert a Tab before task 2 for example
- [] task 1  
→-[] task 2
- [] task 3

### Expected result

Task 2 has a CSS type of a sub-task, that my CSS snippet would transform into a nice checkbox.

### Actual result

Task 2 get this CSS type:

`<span class="cm-formatting cm-formatting-link cm-link cm-list-1 cm-hmd-barelink">[</span>`

It is not a task any more!  
This forbids nice formatting in edition mode with custom CSS.  
It seems like a bug to me.

### Environment

- Operating system: Mac OS Big Sur 11.2.1

- Obsidian version: v0.10.13

* * *

### Additional information
![Capture d’écran 2021-02-11 à 16.12.54|690x321](upload://13skLpXDBcQjOK64Bh29AmauSAI.png) ![Capture d’écran 2021-02-11 à 16.13.02|679x325](upload://gkoWQ7DkGwnOpQDqfJXsIi80Q0C.png)

---

<div class="post-metadata">

**Author:** ![ryanjamurphy](https://forum.obsidian.md/user_avatar/forum.obsidian.md/ryanjamurphy/32/334_2.png) [@ryanjamurphy](https://forum.obsidian.md/u/ryanjamurphy)\
**Post date:** [February 11, 2021, 3:46pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/2 "2021-02-11T15:46:42Z")

</div>

> [@ChezFrancois](#):
>
> - task 1
> - task 2
> - task 3  
> Then, insert a Tab before task 2 for example
> - task 1  
> →- task 2
> - task 3

Can you paste the raw text you’re using? This works for me:

```auto
- [] Task
    - [] Task
- [] Task

```

Note you can surround text in three backticks (```) to show the raw input.

---

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 11, 2021, 8:30pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/3 "2021-02-11T20:30:06Z")

</div>

Yes, it works in the standard Obsidian editor’s UI.

But when you try to apply a CSS snippet to make the appearance of tasks nicer, it doesn’t work. The reason is that sub-tasks are miss-managed by the editor, so CSS can not apply a task format to something which is not any longer identified as such.

Screenshot with just tasks:  
 ![Capture d’écran 2021-02-11 à 21.28.05](https://forum.obsidian.md/uploads/default/original/2X/2/239d1dda4adb1b6be748fa5f0dfcace35fd61eaa.png)

Screenshot with a subtask:  
 ![Capture d’écran 2021-02-11 à 21.28.16](https://forum.obsidian.md/uploads/default/original/2X/7/7423d0689f2c809119fb76008a65828d793f825a.png)

With cursor “activating” the line where the subtask is:  
 ![Capture d’écran 2021-02-11 à 21.28.23](https://forum.obsidian.md/uploads/default/original/2X/8/8c61416fa20b8626380725447581f14c39b2fde6.png)

---

<div class="post-metadata">

**Author:** ![Erisred](https://forum.obsidian.md/user_avatar/forum.obsidian.md/erisred/32/6273_2.png) [@Erisred](https://forum.obsidian.md/u/Erisred)\
**Post date:** [February 12, 2021, 3:13am UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/4 "2021-02-12T03:13:40Z")

</div>

I have an idea as to what’s causing this. You’ll have to contact the authors to verify, but usually they will first _remove_ the default check box, then add their own cool symbol in its place.

Similar to [this post](https://forum.obsidian.md/t/children-bullet-points-instead-of-dashes/11786/4) about bullet points they will sometimes forget to include all list-item-children in the code.

Can you share the code snippet you are using?

---

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 12, 2021, 7:09am UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/5 "2021-02-12T07:09:11Z")

</div>

The entire code is shared in this post:

> [@Typora like custom CSS](https://forum.obsidian.md/t/typora-like-custom-css/12822):
>
> Leveraging several proposals to tweak Obsidian and make it behave as nearly as possible from Typora in the edition mode, I came to the following CSS snippet that works wonderfully well, yet staying simple. Use it at your leisure: /\* inline formatting, link targets and [[]] disappears if not active line\*/ div:not(.CodeMirror-activeline)\>.CodeMirror-line span.cm-formatting, div:not(.CodeMirror-activeline)\>.CodeMirror-line span.cm-string.cm-url, div:not(.CodeMirror-activeline)\>.CodeMirror-line s…

The part related to tasks is hereunder:  
/\* Checkboxes instead of brackets in edit mode \*/  
div:not(.CodeMirror-activeline)\>.CodeMirror-line span.cm-formatting-task.cm-meta,  
div:not(.CodeMirror-activeline)\>.CodeMirror-line span.cm-formatting-task.cm-property {  
color: transparent;  
position: relative;  
display: inline !important;  
margin-right: -0.1rem;  
}

div:not(.CodeMirror-activeline)\>.CodeMirror-line span.cm-formatting-task.cm-meta:after,  
div:not(.CodeMirror-activeline)\>.CodeMirror-line span.cm-formatting-task.cm-property:after {  
content: “○”;  
position: absolute;  
top: 3px;  
left: 0px;  
color: rgb(219, 95, 12);  
font-size: 18px;  
}  
div:not(.CodeMirror-activeline)\>.CodeMirror-line span.cm-formatting-task.cm-property:after {  
content: “✓”;  
color: rgb(124, 131, 124) !important;  
}  
span.cm-formatting-task.cm-property ~ span {  
text-decoration: line-through;  
color: rgb(124, 131, 124) !important;  
}

---

<div class="post-metadata">

**Author:** ![pjeby](https://forum.obsidian.md/user_avatar/forum.obsidian.md/pjeby/32/8080_2.png) [@pjeby](https://forum.obsidian.md/u/pjeby)\
**Post date:** [February 12, 2021, 7:42am UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/6 "2021-02-12T07:42:27Z")

</div>

You are missing a space between the `-` and the `[]` (or have a not-recognized-as-whitespace character there). That’s the source of the issue.

You can tell this because with a space, the `[]` gets classes of `cm-formatting cm-formatting-task cm-meta`, but without a space, the opening bracket gets `cm-formatting cm-formatting-link cm-link cm-list-1 cm-hmd-barelink`, as shown here.

In other words, this is not an Obsidian bug; it’s an error in the markdown. The space after a list marker is not optional in markdown syntax.

---

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 12, 2021, 11:32am UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/7 "2021-02-12T11:32:50Z")

</div>

In the example shown above, there is a normal space in the tasks and in the sub-task. That is not the source of the problem.

First level task is written like this: “-” space “[” space "] and is recognized as a task  
Second level task or sub-task is written like this: tab “-” space “[” space "] and is not recognized as a task.

---

<div class="post-metadata">

**Author:** ![Erisred](https://forum.obsidian.md/user_avatar/forum.obsidian.md/erisred/32/6273_2.png) [@Erisred](https://forum.obsidian.md/u/Erisred)\
**Post date:** [February 12, 2021, 1:29pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/8 "2021-02-12T13:29:38Z")

</div>

@ChezFrancois - You definitely have something else affecting this. It could be missing/extra whitespace somewhere in the raw text as @pjeby suggests, but I suspect there’s something in your stylesheet(s) you have not shown us here.

When I add _just the snippet_ you gave to a simple file (using a vault with NO other css or plugins), quite a bit is missing:

 ![image](https://forum.obsidian.md/uploads/default/original/2X/7/7fc47540dc11bb241513261e8dcd548484330914.png)

However, when adding the entire stylesheet you linked to, things look fine to me:  
 ![image](https://forum.obsidian.md/uploads/default/original/2X/5/51e11ad2d77e07b5c62d255565c8f5a43789235d.png)

Basically, I don’t think there’s a bug in Obsidian, I think you have a bug in your stylesheet(s) (assuming the whitespace isn’t the issue).

One last thought - if you are using this snippet, then applying a community theme on top of it, there’s a good chance they are conflicting one another.

---

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 12, 2021, 5:26pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/9 "2021-02-12T17:26:32Z")

</div>

Thanks for sharing this test.  
I sliced the stylesheet in small pieces to test their interactions. The problem is more complex than I thought.  
I will share my findings and possibly a solution when I will have finished.

---

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 12, 2021, 6:04pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/10 "2021-02-12T18:04:18Z")

</div>

Exploring different options, I discovered that, if, in editor’s parameters, Tab size (number of spaces a tab is equivalent to) is below or equal to 4, checkboxes are displayed correctly:  
 ![Capture d’écran 2021-02-12 à 18.58.00](https://forum.obsidian.md/uploads/default/original/2X/4/46dfc194b8b1f63b92a034676dbdb1048e523d50.png)  
As soon as this parameter is set at 5 or above, the checkboxes of sub-tasks disappear. Strange?  
 ![Capture d’écran 2021-02-12 à 18.57.31](https://forum.obsidian.md/uploads/default/original/2X/e/ee1f8383c52de7d8351c7123a1aabaa0cae2e8d8.png)

What is the explanation of that?

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [February 12, 2021, 6:33pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/11 "2021-02-12T18:33:41Z")

</div>

Because the markdown spec is more complicated than it seems. (there is actually a right range of whitespaces, and you go from no task, task, no task).  
This is true for lists in general.

I didn’t go too deep into this issue however we are aware that there are bugs in the editor parsing, (there are even bugs in the preview made by remark!).

I am not sure there is bug here, but if there is, it won’t get address until we do an overhaul of the editor.

---

<div class="post-metadata">

**Author:** ![pjeby](https://forum.obsidian.md/user_avatar/forum.obsidian.md/pjeby/32/8080_2.png) [@pjeby](https://forum.obsidian.md/u/pjeby)\
**Post date:** [February 12, 2021, 6:49pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/12 "2021-02-12T18:49:25Z")

</div>

After fiddling this for a while, I’m pretty sure that Obsidian is not violating the Commonmark spec. (At least not in any obvious way.)

The issue here is that nested lists are allowed a maximum indent of 3 spaces beyond the width of the parent list item marker (`-` and a space in this instance). Beyond that, it’s supposed to be considered a code block, at least if there is a blank line above it. However, if there’s no blank line, it fails the Commonmark indented list rule, and falls back to being treated as part of the current paragraph (i.e., the list line above it).

(You can see this more clearly in preview mode, where the contents of the item are wrapped up onto the previous task list line.)

So, I think the short answer to this is, follow Commonmark indentation rules, and you’ll be fine.

---

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 12, 2021, 8:21pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/13 "2021-02-12T20:21:05Z")

</div>

That seems to close the debate effectively. And yes, it makes Markdown more complex than I thought.  
Thanks to all respondents who helped sort this mystery!

---

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 13, 2021, 10:22am UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/14 "2021-02-13T10:22:00Z")

</div>

One more remark: The current behavior of Obsidian may be consistent with CommonMark indentation rules, but is not with the choice proposed in the Editor’s parameters.  
If this parameter can be set anywhere between 2 and 8, nothing should change but the indentation distance. Or a warning should be added, explaining that for a value of 5 or above the behavior of tasks lists will change regarding sub-tasks.

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [February 13, 2021, 12:56pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/15 "2021-02-13T12:56:45Z")

</div>

the editor parmeter is about converting tabs to spaces not about lists and commonmark

---

<div class="post-metadata">

**Author:** ![ChezFrancois](https://forum.obsidian.md/letter_avatar_proxy/v4/letter/c/c0e974/32.png) [@ChezFrancois](https://forum.obsidian.md/u/ChezFrancois)\
**Post date:** [February 13, 2021, 2:28pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/16 "2021-02-13T14:28:33Z")

</div>

One can use tab to create a sub-point or a sub-task. Then, this parameter has a direct influence on lists.

---

<div class="post-metadata">

**Author:** ![WhiteNoise](https://forum.obsidian.md/user_avatar/forum.obsidian.md/whitenoise/32/11_2.png) [@WhiteNoise](https://forum.obsidian.md/u/WhiteNoise)\
**Post date:** [October 13, 2022, 4:11pm UTC](https://forum.obsidian.md/t/sub-tasks-in-tasks-lists-are-not-correctly-identified-by-obsidian/12820/17 "2022-10-13T16:11:51Z")

</div>

Archived on October 13, 2022, 4:11pm UTC


