TODO TRIGGER

Tie special actions to converting between TODOs and DONEs!

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 the extension doesn't work after using the copy extension button above, try installing manually using the instructions below.

First create a block with the text {{[[roam/js]]}} on any page in your Roam DB. Then, create a single child of this block and type three backticks. A code block should appear. Copy this code and paste it into the child code block in your graph:

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

Finally, click "Yes, I Know What I'm Doing".


Usage

This extension uses an older configuration system where it uses Roam attributes. To specify an attribute, create a block with the field name written as Name:: and the value right next to it.

This extension supports the following configuration options, 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. It supports the following place holders:

    • /Current Time - inserts the current time

    • /Today (deprecated) - inserts the the current day

    • {now}- inserts the current day. Use {now:skip dnp} to skip adding the current day when the TODO is on a daily note page.

  • On Todo - (Optional) The text to add to the end of a block, when a block first becomes a TODO. It supports the following place holders:

    • /Current Time - inserts the current time

    • /Today (deprecated) - inserts the the current day

    • {now}- inserts the current day. Use {now:skip dnp} to skip adding the current day when the TODO is on a daily note page.

  • 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

    • There are a couple of placeholders this option supports. {date} maps to any date tag and {today} maps to today. So you could configure Replace Tags:: {date}, {today} to replace a date tag with today's date.

  • Strikethrough - (Optional) Set to True to strikethrough blocks with {{[[DONE]]}}.

  • Classname - (Optional) Set to True to add a roamjs-done classname to blocks with {{[[DONE]]}}. You could then style the block to your liking with roam/css.

  • Explode - (Optional) Set to True to play a fun animation when the TODO is finished

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. This extension also works on multiple blocks at once.

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


Contributors

This extension is brought to you by RoamJS! If you are facing any issues reach out to support@roamjs.com or click on the chat button on the bottom right.

If you get value from using this extension, consider sponsoring RoamJS by clicking on the button below!

Other Extensions