Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support alternative checkboxes #76

Merged
merged 3 commits into from
Jan 22, 2024
Merged

Support alternative checkboxes #76

merged 3 commits into from
Jan 22, 2024

Conversation

tobiasvl
Copy link
Contributor

Many Obsidian themes support "alternative" checkboxes (Minimal, for example), where different characters inside the checkbox brackets give additional meaning to the checkbox.

Currently, this plugin will consider such alternative checkboxes (including the common - [/] checkbox, which means "incomplete") as finished, and not roll them over.

This PR changes this, so only - [x]/- [X] ("done") and - [-] ("canceled") are considered "finished" checkboxes. All other checkboxes are considered "unfinished" and will be rolled over.

@lumoe
Copy link
Owner

lumoe commented Jan 13, 2023

Thank you for your contribution @tobiasvl, looks like a neat feature which we should add.

I just merged a bigger change into the codebase, which changes the way we extract ToDos from the documents and added some test.

Can I ask you to check out the newest version, add your changes and extend the test cases that cover the expected behaviour?

@tobiasvl
Copy link
Contributor Author

@lumoe Okay, I think this should do it. I added a couple of tests I thought made sense (and fixed an unrelated typo in a separate commit). Let me know if you need anything else. (I haven't run the tests locally, and you need to approve running the CI, so we'll see if it works!)

@tobiasvl
Copy link
Contributor Author

@lumoe Let me know if you need anything else from me!

@tim-hilt
Copy link
Collaborator

tim-hilt commented Jan 18, 2023

I think this is hard to standardize. - [ ] and - [x] / - [X] seem to be accepted by a big audience. Looking at the minimal checklist-items, I see multiple ones that could be referred to as "terminal status" and should therefore not be rolled over.

Shouldn't we add more characters to the regex if we are referring to the minimal-theme? Does it make sense for a very wide audience to refer to minimal-theme? Which other themes exist that enlarge the todo-items-functionality?

@tobiasvl
Copy link
Contributor Author

- [ ] and - [x] / - [X] seem to be accepted by a big audience.

Those are part of the Markdown standard, so yes, I would hope so!

Looking at the minimal checklist-items, I see multiple ones that could be referred to as "terminal status" and should therefore not be rolled over.

Shouldn't we add more characters to the regex if we are referring to the minimal-theme?

Which other ones do you see that could be referred to as "terminal"? I feel like - [-] (cancelled) is the only one that's definitely terminal.

I admit that this pull request adds semantic interpretation to syntax that doesn't have any inherent semantics, so people might use these checkboxes differently. I'm open to either adding more (risking that we roll over some checkboxes that people might not want to roll over) or removing - [-] to only support standard Markdown to avoid adding semantic meaning to any of these alternative checkboxes (but I felt that interpreting a "cancelled" checkbox as one that shouldn't be rolled over was pretty safe).

Either of those solutions (or my original one) is IMO better than the current situation, where no alternative checkboxes are rolled over. After all it's safer to roll over too eagerly than the opposite, because that could cause people to "lose" and forget checkboxes without intending to. That was the motivation behind the change.

Does it make sense for a very wide audience to refer to minimal-theme? Which other themes exist that enlarge the todo-items-functionality?

I could find some more examples of themes that support alternative checkboxes, if it's useful. Minimal isn't the only one.

@tim-hilt
Copy link
Collaborator

tim-hilt commented Jan 18, 2023

Those are part of the Markdown standard

Do you mean the GitHub-flavor?

Which other ones do you see that could be referred to as "terminal"?

At least - [>] forwarded seems to signify that there is nothing else to do for this entry.

I could find some more examples of themes that support alternative checkboxes, if it's useful.

That's a great suggestion. This way we can make sure that the plugin offers the right behavior for more users.

@tobiasvl
Copy link
Contributor Author

Do you mean the GitHub-flavor?

Yes, that's what I mean, sorry. It's not part of the official Markdown spec, I forgot since there are so many different ones. But, of course, it's also part of the Markdown supported by vanilla Obsidian (ie. with the standard theme).

By the way, GitLab's Markdown flavor supports an "inapplicable" checbox (- [~]), similar to (and originally suggested to be identical to) the "cancelled" - [-] one: https://docs.gitlab.com/ee/user/markdown.html#task-lists

At least - [>] forwarded seems to signify that there is nothing else to do for this entry.

I can see that. I interpreted it as "forwarded to next sprint/day/whatever". I guess I fell victim to the same semantic interpretation problem!

@tim-hilt
Copy link
Collaborator

it's also part of the Markdown supported by vanilla Obsidian

Of course - you're right. My first comment was pointless 🙈

@tim-hilt
Copy link
Collaborator

tim-hilt commented Feb 9, 2023

fixes #87

@hilsonp
Copy link

hilsonp commented Feb 26, 2023

Hello,

Thank you for the plugin and for the cr.

As shown in this comment, I adapted the regex to match my needs,

Some people may like to only roll-over [ ] items.
Other may want to roll-over [ ] and [/].
Some other may want to roll over [ ], [/] and [>].
Yet other way roll over [?] as well but won't like the [>] to be rolled-over.

I think this is up to every one understanding/use of the different themes, semantic and markdown flavor.
Future will surely bring new things anyway.

Therefore, why not exposing a input box allowing people to enter a list of chars they would like to "roll-over" ?
The javascript would transform this string into the inner part of a regex bracket expression (escaping characters when needed (eg: / instead of /, ] instead of ])).
Having a space in this input box may not be easily visible so we may choose to always rollover [ ] and letting people put in the input box characters other than space that they would like to roll-over.

This would make the implementation very flexible and future proof.

@Rob-Conan
Copy link

Is there any update on this PR, I'd love to for this functionality to be added to Rollover Daily ToDos.

@chrabia
Copy link

chrabia commented Jan 10, 2024

hello. Are there any updates? Any reasons not to merge this MR?

@lumoe lumoe merged commit 5b6c0b1 into lumoe:master Jan 22, 2024
1 check passed
@lumoe
Copy link
Owner

lumoe commented Jan 22, 2024

New plugin version with updated checkbox logic is live. Update available in Obsidian.

@tobiasvl tobiasvl deleted the patch-1 branch January 24, 2024 00:15
@dictionarymouse
Copy link

How does this work? Is the user able to define which task states rollover and which don't?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants