SERENDIPITY

Various methods of introducing randomness into your Roam Graph!

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 type three back ticks. A code block should appear. Copy this code and paste it into the child code block in your graph:

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

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


Usage

Installing the Serendipity extension will create a [[roam/js/serendipity]] page if one does not exist already. On that page, you could configure various Serendipity related features.

Daily

The Daily feature will add random block references from your graph on to your daily notes page each day each timeyou log in to Roam. It supports the following settings:

  • includes - The set of tags used to mark block references to pull randomly from. All blocks marked with one of these tags, or is a child of a block marked with one of these tags will be included. Can specify more than one. Default is empty. If one of the nested blocks is {all}, then all block uids from the graph will be included.

  • excludes - The set of tags used to mark block references to exclude from the set to pull randomly from. All blocks marked with one of these tags, or is a child of a block marked with one of these tags will be excluded. Can specify more than one.

  • label - The label that gets added to your daily note page that's used to nest the randomly chosen block reference. Default value is [[roam/js/serendipity]].

  • timeout - The number of days that must pass before a block reference can be included in the randomness pool. Default value is 0.

  • count - The number of block references to randomly pull from. Default value is 3.

  • character minimum - Blocks must have at least this many characters to be considered for random selection. Default value is 0.

  • word minimum - Block must have at least this many words to be considered for random selection.

  • location - The location on your Daily Note Page where the serendipity blocks will be created. By default, it inserts at the top.

You could manually trigger the daily random block reference query by adding a {{serendipity}} block on a given daily note page and clicking the button.

Each time a set of block references are randomly added to a daily note page, an arrow icon will appear to the right of the label. Clicking this icon will open all nested block references in the right sidebar. Warning: this could have poor performance if clicked with a lot of nested blocks.

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!

A special thanks to those who's contributions also helped make this extension possible:

Other Extensions