Checklists: Main plugin

name

Checklists

icon

library_add_check

description

Adds support for checkboxes and checklists that are not tasks. (Requires additional plugins! See instructions.)

instructions

This plugin adds special functionality to Unicode checkbox characters "⬜" and "✅" and is part of a suite of several plugins and scripts required to get the full functionality working. (Due to limitations in the Amplenote plugin system, it's not possible to provide all features in a single plugin.)

Please read all of the instructions, including footnotes, there are some gotchas here because of limitations in the Amplenote plugin system and also some bugs Amplenote has at the time of writing this!

Install this plugin (this adds the plugin actions on selected text)

Install the o plugin (this is required to allow the use of {o})

Install the x plugin (this is required to allow the use of {x})

Install TamperMonkey in your browser (this is required for the next step)

Install the companion userscript (this is required to allow double-clicking checkboxes and using the Ctrl+E/Ctrl+Shift+E/Ctrl+Space hotkeys described below)

The userscript will also work in the PWA (=when you click the "install" option from the website and get a separate icon). It doesn't work in the newly released official Desktop app.


Note: It was announced that in the near future, using TamperMonkey will require enabling the "developer mode" checkbox in the Chrome extension settings. If this becomes too much of a hurdle, I may consider releasing actual browser extensions at some point, but for now I hope it will be okay.

⚠️ The following instructions will only work once all of the above has been set up!

Use {o} and {x} to add these boxes to a note ({o} for "⬜" and {x} for "✅").

Then you can select them and use actions to check/uncheck them.

This also works for multiple boxes within selected text, but due to limitations in the Amplenote plugin system, this will also destroy all formatting, unfortunately.

There is also an action to insert or remove checkboxes in front of every line, but again, due to limitations in the plugin system, this will remove all other formatting from the selected text. (As a side effect, though, the "Add checkboxes to lines" action can be used to convert lists of tasks to checklists, since their formatting as tasks will get lost.)

Of course, using an action to toggle boxes and having formatting removed when trying to batch-(un)check boxes is a bit annoying and cumbersome, but that's where the userscript comes in. The following is applicable only when you use a desktop browser with the companion userscript installed (on mobile, you need to use the plugin actions instead):

On desktop in a browser or PWA (not the new desktop app), you can double-click a checkbox to toggle it. There are also two main hotkeys added by the userscript:

Ctrl+E:

Inserts an unchecked checkbox ("⬜") at the cursor position.

Inserts or removes checkboxes in front of every selected paragraph or list item.

Toggles a checkbox if cursor is positioned left or right of it or a single checkbox is selected.

Ctrl+Shift+E:

Inserts a checked checkbox ("✅") at the cursor position.

Toggles all checkboxes within selection (first checking all, unless all of them were already checked; then unchecking all) - without destroying formatting.

Toggles a checkbox if cursor is positioned left or right of it, just like Ctrl+E does.

Additionally, Ctrl+Space can be used to toggle a checklist item just like it can be used to complete a task or toggle strike-through of a bullet list item in Amplenote normally. If the cursor is within a paragraph or a bullet list item that starts with a checkbox, pressing Ctrl+Space will toggle that checkbox at the beginning of the line.

For Evernote users: If you want to import a note from Evernote with all the inline checkboxes converted to the ones usable with this plugin suite, you can use my ENEX checkbox converter page. Simply select an ENEX file and click "Convert" to get a version which will result in inline checkboxes instead of tasks when imported to Amplenote!

☕ If you like my work, you can buy me a coffee!


Example use (with userscript):


({
replaceText: {
'Check box(es)': {
check (app, text) {
return text.includes('⬜')
},
async run (app, text) {
await app.context.replaceSelection(text.replaceAll('⬜', '✅').replaceAll('\n', '\n\n')) // We need to use replaceSelection with Markdown even though there is no Markdown in the string because otherwise \n will vanish eventually.
}
},
'Uncheck box(es)': {
check (app, text) {
return text.includes('✅')
},
async run (app, text) {
await app.context.replaceSelection(text.replaceAll('✅', '⬜').replaceAll('\n', '\n\n')) // We need to use replaceSelection with Markdown even though there is no Markdown in the string because otherwise \n will vanish eventually.
}
},
'Add checkboxes to lines': {
check (app, text) {
return !!text.match(/^(?!$)/m)
},
async run (app, text) {
await app.context.replaceSelection(text.replace(/^(?!$)/mg, '⬜ ').replaceAll('\n', '\n\n')) // We need to use replaceSelection with Markdown even though there is no Markdown in the string because otherwise \n will vanish eventually.
}
},
'Remove checkboxes from lines': {
check (app, text) {
return !!text.match(/^(?!$)/m)
},
async run (app, text) {
await app.context.replaceSelection(text.replace(/^[⬜✅]\s*/mg, '').replaceAll('\n', '\n\n')) // We need to use replaceSelection with Markdown even though there is no Markdown in the string because otherwise \n will vanish eventually.
}
}
}
})

Note: In the future, I'd like to add actions to the plugin itself to add or remove checkboxes to/from the beginning of each paragraph or list item in the selection (currently supported only via Userscript) as well as to convert checklists to/from a list of actual tasks (currently only supported one-way as side effect of the "Add checkboxes to lines" action), but this is currently not possible with Amplenote's plugin system because there is no way to change parts of selected text without destroying all formatting.