TODO TRIGGER

The TODO Trigger extension allows the user to tie an action upon converting a TODO to DONE. The name of the script is todo-trigger.

Installation

You could use the Copy Extension button below to individually install this extension. To install, just paste anywhere in your Roam graph and click "Yes, I Know What I'm Doing".

Manual Installation

If instead you prefer to manually install, first create a block with the text {{[[roam/js]]}} on any page in your Roam DB. Then, copy and paste this code block as a child of the block.

var existing = document.getElementById("todo-trigger");
if (!existing) {
  var extension = document.createElement("script");
  extension.src = "https://roamjs.com/todo-trigger.js";
  extension.id = "todo-trigger";
  extension.async = true;
  extension.type = "text/javascript";
  document.getElementsByTagName("head")[0].appendChild(extension);
}

Usage

The script supports the following configuration attributes, to be added in the [[roam/js/todo-trigger]] page:

  • Append Text - (Optional) The text to add to the end of a block, when an item flips from TODO to DONE. Could use "/Current Time" to always put the current time and "/Today" to always put the current day. All other text is static.
  • Replace Tags - (Optional) The set of pairs that you would want to be replaced upon switching between todo and done. Multiple pairs are deliminited by | and each pair is delimited by ,. For example, Replace Tags:: #toRead, #Read | #toWrite, #Written
  • Strikethrough - (Optional) Set to True to strikethrough blocks with {{[[DONE]]}}.

Anytime a TODO checkbox becomes DONE, either by user click or keyboard shortbut, the "Done" action fires. Similarly, when a DONE checkbox becomes TODO, the "Todo" action fires.

When "Append Text" is configured, the "Done" action appends the configured text to the end of the block. The "Todo" action removes the configured text from the end of the block.

When "Replace Tags" is configured, the "Done" action replaces each pair's first tag with the second tag. The "Todo" action does the same replacement in reverse.

When "Strikethrough" is configured the "Done" action adds a strikethrough to the block. The "Todo" action removes it.

When None are configured, nothing happens.

Demo

Other Extensions