SMARTBLOCKS

Create custom and programmable templates from within Roam!
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-smartblocks-main");
if (!existing) {
var extension = document.createElement("script");
extension.src = "https://roamjs.com/smartblocks/main.js";
extension.id = "roamjs-smartblocks-main";
extension.async = true;
extension.type = "text/javascript";
document.getElementsByTagName("head")[0].appendChild(extension);
}
Finally, click "Yes, I Know What I'm Doing".
Overview
SmartBlocks makes it easy to reuse text in a dynamic way in Roam. It can be compared to other snippet/template insertion tools like TextExpander and Alfred. However, SmartBlocks completely lives in your Roam graph and can smartly interact with your graph. All SmartBlocks workflows are defined in the graph and are performed in your graph. SmartBlocks are made of the following key components:
Workflows: These are the definitions of what the SmartBlock will do, it serves as a template for the SmartBlocks actions. These can be predefined or custom workflows.
Commands: Commands are instructions that make your SmartBlock workflow do amazing and dynamic things.
Trigger: The keystrokes you type so that the workflow is run. The default keystroke is
jj
Table of Contents
The following steps dive into all the features SmartBlocks has to offer in increasing complexity; from beginners to developer.
Demo
Migration
This extension was inspired by and acts as version 2 of the original smartblocks module in the Roam42 extension. It will soon replace the current smartblocks module in Roam42. For a list of all the non-backward compatible changes from V1 to V2, check out out Migration Guide.
Support
There is an active community at roamresearch.slack.com channels #roam42
and #roamjs
discussing and building SmartBlocks. Stop by if you need help or want to share your ideas.
Next Up: Trigger Your Workflow
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:

Jorge Mir Alvarez
π΅
Rahul Matthan
π΅
Montgomery Kosma
π΅
David W Plummer
π΅
Duane D Rudy
π΅
Terese Brewster
π΅
Mattheus Peereboom
π΅
Edwin Rooijakkers
π΅
Joey Harris
π΅
Eric Peterson
π΅
Vincent Tam
π΅
Kenneth Bram
π΅
Alan Ogle
π΅
Paul Hacker
π΅
John Trainor
π΅
Steve Greene
π΅
Alex Young
π΅
Kaushal Kashyap
π΅
Christopher Reath
π΅
Brian Barry
π΅
Michael Ibara
π΅
Roy Temple
π΅
Michael Marino
π΅
Fadhilah Wahid
π΅
Michael F. Byrne
π΅
Nate Stell
π΅
Michael J D Ede
π΅
Ravi Mandliya
π΅
Joseph Goodson
π΅
Kara Monroe
π΅
Michael Brockbals
π΅
Margaret K Delano
π΅
Jacques Gautreau
π΅
David R Schulman
π΅
Mike Judd
π΅
Jessica DeVita
π΅
Andreas Von Gunten
π΅
Solomon Weiler
π΅
Jessica Shieh
π΅
Ray Nestor
π΅
Mark Bulling
π΅
William R Petro
π΅
MAGNUS HELGERUD SΓRBY
π΅
Behrooz Bashokooh
π΅
Jacques Tardie
π΅
JonΒ Surrat
π΅
Matthew J Brockwell
π΅
JC Cangilla
π΅
Peter Rosso
π΅
Christoph Weniger
π΅
Benjamin D.
π΅
ANDREW C MACOMBER
π΅
Habib Sayah
π΅
Vaibhav Chadha
π΅
Sabi Sika Boni Guessou
π΅
TH.J.M. Koster
π΅
Tony Lembke
π΅
Christopher Boyer
π΅
Gallet
π΅
Michael Norrie
π΅
Adam Naudascher
π΅
Jack Montoya Jr.
π΅
Karaminder Ghuman
π΅
Dr S Hill
π΅
Scott Ian Taylor
π΅
TALI LERNER
π΅
Giovanni Faga
π΅
g.a. Epping
π΅
Milan Stanojevic
π΅
RB Mulholland
π΅
David Wilson
π΅
Asaf Dafna
π΅
Billy Linder
π΅
S Venkatesan
π΅
Russell Pasetes
π΅
Cherry Sun
π΅
David Weiss
π΅
Larry Bernstein
π΅
Mridula Duggal
π΅
TSUKASA GOZAOKA
π΅
LE NGOC QUOC HUY
π΅
Sangmin Ahn
π΅
Merril Pious Jacob
π΅
Arlen Hooley
π΅
W M Tappin
π΅
Daniel helou rahal
π΅
Ashwin Siddarth
π΅
Joseph A Moody
π΅
Tsao Jian-hsiung
π΅
Nigel Rawlins
π΅
Scott Fry
π΅
Akhilender Singh
π΅
YU KUWANO
π΅
Matthew Mckinlay
π΅
Aleksey Tentler
π΅
SANTOSH ANGADI
π΅
Andre Foeken
π΅
John Gulledge
π΅
Jordan Burton
π΅
TsunKuo Kuo
π΅
Ami Pedahzur
π΅
Jason Edleman
π΅