obsidian-tasks
obsidian-tasks copied to clipboard
In combination with SlrVb's S-Checkbox CSS, Task Plugin breaks that style.
This is an interaction issue between this plugin and the CSS Snippet from @SlRvb. In their CSS snippet, they give alternate possibilities for icons based on the string between the bracket characters. The letter is case sensitive. Using Task Plugin, conflicts with this and disrupts the encoding of the task icons.
Expected Behavior
It seems that Task Plugin is lowercasing all values inside of the brackets. I'd expect it not to touch the contents between [
and ]
.
Current Behavior
Since values are lowercased, the snippet from SlRvb incorrect identifies the icons as other tasks and places the incorrect icons.
Steps to Reproduce
- Install Task plugin
- Install SlrVb's Alternative Checkbox CSS at https://github.com/SlRvb/Obsidian--ITS-Theme/blob/main/S%20-%20Checkboxes.css
- Use following markdown
- [x] task completed [x]
- [X] task done/alt. [X]
- [D] task deferred [D]
- [P] task pro [P]
- [p] Paraphrase [p]
- [B] task brainstorm [B]
- [b] task bookmark [b]
- [C] Contradict [C]
- [c] Choice [c]
- [I] task info [I]
- [i] task idea [i]
- [R] Research
- [r] Reward
- [N] Ask note [N]
- [L] Location [L]
- [E] Example [E]
- [A] Answer [A]
Context (Environment)
- Obsidian version: 0.13.24
- Tasks version: 1.4.1
- [x] I have tried it with all other plugins disabled and the error still occurs
Possible Solution
If possible do not lowercase values between brackets.
The reason for the error seems to be caused by Tasks plugin lowercasing the data-task
values in the DOM for Reading Mode only. (Thus why the snippet still works as intended in Live Preview)
I'm not sure what this plugin is doing as to why it would do this, but recommend leaving the DOM alone in any case.
Without Tasks enabled:
With Tasks enabled:
Thank you both for the good report @namtrah and @SlRvb!
The current implementation of Tasks completely replaces each LI
element that is a task with a new one. I don't remember why I implemented it this way back when :monocle_face: Of course, it should only be a listener on the checkbox and not a complete replacement of the li-element.
I'll fix this when I have the time. I need to add "only-listeners" for live-preview. This could be a good time to sanitize reading mode.
Came to report this. Good to know, a fix is in the works. 👍
I think there are two places in the Tasks code where the status text is being converted to a lower-case version.
- https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/Task.ts#L220
- https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/Commands/ToggleDone.ts#L106-L109 -> in this case I think any letter would be overwritten with 'x' specifically?
I suspect that inlineRenderer.ts
is the file that is making changes to Reading Mode, but I do not have enough knowledge to the related topics to figure out everything that is happening here. Anyway, hope that this can help @claremacrae or someone else track this down!
I think there are two places in the Tasks code where the status text is being converted to a lower-case version.
- https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/Task.ts#L220
- https://github.com/obsidian-tasks-group/obsidian-tasks/blob/main/src/Commands/ToggleDone.ts#L106-L109 -> in this case I think any letter would be overwritten with 'x' specifically?
Thanks @AnnaKornfeldSimpson .... A tiny GitHub tip when pasting links with line numbers... if instead of /main/
you include the most recent commit by selecting 'Copy permalink' like this....
... then you get a link that GitHub knows is pinned to a line (or lines) and so it embeds it in comments - like this - and the line number doesn't get stale over time if the file changes...
-
https://github.com/obsidian-tasks-group/obsidian-tasks/blob/650f6525ffb397ab192deca37d788fb582ab74c2/src/Task.ts#L220
-
https://github.com/obsidian-tasks-group/obsidian-tasks/blob/07cb68be18debc65a831a9ba5fa61c9c296eefeb/src/Commands/ToggleDone.ts#L106-L109
I've got a fix for this.
For the record, I'm intentionally leaving the code in ToggleDone.ts
unchanged, as it is not required to fix the behaviour reported here - and changing it would require time spent evaluating the changed behaviour, which doesn't benefit those waiting a fix for this issue.