sort checklist

Posted by FlohGro, Last update about 2 years ago


about 2 years ago

name and description updated

created by @FlohGro / more on my Blog

sort checklist

This action sorts a list of checkboxes based on their state. All done items will be moved to the end of the draft into the section titled with „## done


no configuration needed


Use this action when you have a checklist open and don’t want to delete done items with the clean done items in list action but instead move them into a „## done“ section. You can use the Show List action to open your lists quickly.

If you find this useful and want to support me you can

Buy Me A Coffee


  • script

    // sort simple list
    // break draft into lines
    var lines = draft.content.split("\n");
    var begin = '';
    var end = '';
    var c = "- [x]";
    // sort lines based on their leading characters
    for(var line of lines){
    	var check = line.includes(c);
    	// if line contains c:
    	if (check) {
    		end += line + "\n";
    	} else if ( line.includes("## done")){
    		//ignore line!
    		begin += line + "\n";
    // recompile / reorder draft
    begin = begin.slice(0,-1);
    end = end.slice(0,-1);
    editor.setText(begin + "\n" + "## done\n" + end + "\n");


  • After Success Default
    Notification Info
    Log Level Info
Items available in the Drafts Directory are uploaded by community members. Use appropriate caution reviewing downloaded items before use.