Don't strike through nested checkboxes when outer checkbox is checked

Use case or problem

In my daily notes, I will sometimes nest TODO items under one another, for instance if I encounter a new task to track within the context of another task.

In such cases, marking the outer task as complete results in the sub-task(s) being struck through in preview mode.:

Proposed solution

I would prefer for the indented bullets and checkboxes underneath a completed task to be not struck through.

Current workaround (optional)

None. I deal with it.

Related feature requests (optional)

In the second screenshot above, I would also like the nested bullet to be rendered as a list item (i.e. with a bullet). But this might be an issue with the theme I’m using rather than Obsidian itself.

3 Likes

Update: I upgraded to 0.9.12 right after posting this and it looks like the nested list item is rendered with a bullet glyph. The indentation is a little odd, though:

1 Like

It seems it’s not easily possible to remove strikethrough from child elements without removing it from the full block.
But if it’s acceptable - the greyed out color on the parent block will remain - I found a CSS snippet workaround by CurioHeart on reddit, posted here:

.markdown-preview-view ul > li.task-list-item {
  /* This is to help center the checkbox with other unordered list items; you may want/need to tweak this value for your current theme */
  margin-left: 0.35em;
}
.markdown-preview-view ul > li.task-list-item.is-checked,
.markdown-preview-view ul > li > ul > li.task-list-item.is-checked,
.markdown-preview-view ul > li.task-list-item > ul > li.task-list-item.is-checked {
  text-decoration: none;
  color: var(--text-faint);
}
.markdown-preview-view ul > li.task-list-item.is-checked > ul > li {
  color: var(--text-normal);
}

To use it, create a new text file under vaultFolder/.obsidian/snippets, copy the text in, and save it with .css extension.
Then opening the Obsidian Options, go to Appearance, go down to CSS Snippets section, and enable the file you have created.

3 Likes

Thanks for this! Is it possible to make it work in edit mode as well, i.e. greying out checked tasks in edit mode?