Creating an action to create check lists

Hi,
The drafts app came preinstalled(?) with the “markdown list” "- " feature, which is very useful, but I didn’t see an easy way to create markdown check-list "- [ ] ", so I decided to tweak the “markdown list” feature

What I did
I edited the 2nd line from
var listMark = "-";
to
var listMark = "- [ ] ";

This seemed to do the trick for converting the text to check-lists
“text” → “- [ ] text”

but if I click on it again, it doesn’t remove the check-list completely, but only the dash+space, so it becomes
“[ ] text”
If I press again, it becomes
“- [ ] [ ] text”

I want this action to be a toggle from check-list to no list, and I’ve tried playing around with the script, but cannot figure it out (I should add, that I am still VERY new to this script thing, and don’t know much yet, but I feel it should be a simple thing)

If someone could help me out, that would be very much appreciated.
Thank you.

There is a “Toggle Tasks” action in the default “Editing” action group, which can also be installed from the Directory for this purpose.

(Tasks are not a part of the Markdown spec, but an addition)

I thought I had looked, but I guess I was looking with the wrong search words and in the wrong places.

Apologies for the dumb question, but thanks for helping me out.

This raises a few additional questions though

1, When I toggle this action, it gets rid of the boxes”[ ]”, but not the dash”-“ that are in front of it. Is there a way to get rid of both? Or is the intent to keep it as a list, and maybe toggle the list action to remove the dash?

2, if it is supposed to be a default action, why wasn’t it in my actions library? (Is it because I have owned the app for a while?)

3, if I want to update all the default actions, is the best way to import, without overwriting edited actions, to just install the action groups as a new action, and sort through the duplicates?

Thank you.

Sort of…it could be written to work differently, but it’s written to just remove the tasks now. Hard to know what the user would want in all cases here.

:man_shrugging: There has been some variant of this in the default set for years, but not necessarily this one. You could have deleted it, or just not had it, don’t know.

There is a task in Settings > Maintenance to reinstall the current versions of the default action groups. They install as new groups, so you can just delete your old versions if you have not made modifications you care about.

Thank you for answering my questions!
Very very much appreciated.

Is the edit to also remove the dash in the beginning, a simple edit?
If so, could you tell me which part of the code needs to be edited to do this?