Roam functions and shortcodes

A PDF with a comprehensive list of functions and shortcodes can be found here.

What are functions in Roam?

Roam can be seen as a programming environment for your thoughts. In programming environments, users often have access to functions: small, specialized bits of code that can be used over and over. They can be viewed like a small program within a program. (Or like a magic spell; whatever helps you to understand the concept.)

Most Roam functions have a shortcode that you can type out or add to a text expander extension, but the simplest way is by using the trigger menu (the trigger being the slash (/) key).

Links and references

Links, references, and embeds are Roam’s bread and butter, the thing that made so many knowledge workers fall in love with the app. Whereas links in most note-taking apps are an afterthought, in Roam they’re a primary tool to create pages and to trace the relationship between notes.

Below are the shortcodes to link to any page or block in Roam.

Shortcode Description
{{[[diagram]]}} Diagram. Adds an empty diagram block to the page. You can simply add blocks by nesting them under the block that contains the diagram, or you can double-click on the diagram canvas to add a new block.

Diagrams can be connected with lines and arrows; simply hold the Ctrl key (Windows) or Option key (macOS) while dragging your mouse from one block to another (on the diagram canvas).

{{[[table]]}} Table. Adds a table (rows and columns) to the block where this shortcode is written. Blocks directly nested under the table block are used for rows; blocks nested under row blocks become columns.

You cannot manipulate text in a table directly—for that you need to edit the blocks nested under the table. An exception is the TODO checkbox; that you can check/uncheck in the table.

{{[[kanban]]}} Kanban board. Adds a kanban board (columns with cards) to the block where this shortcode is written. Blocks nested under the kanban block are turned into columns, and blocks nested under the column blocks turn into cards.

You cannot manipulate text in a table directly—for that you need to edit the blocks nested under the kanban board. However, you can drag cards from one column to another, directly on the kanban board.

Working with dates

Dates have their own page in Roam, which show in reverse chronological order on the Daily Notes page. However, you can directly go to a date’s page by using links.

Below the shortcodes to work with dates in Roam. If you want to do more with dates, check out a browser extension like Roam Toolkit or the Roam42 plugin; both let you do Natural Language Processing, so you can write ‘next Monday’ and upon pressing a shortcut it will turn it into a date that’s automatically linked.

Shortcode Description
{{date}} Date picker. Opens a calendar view with date picker. Once you pick a date, the shortcode will become a date with a link to that date’s page.
/today Today’s dateGives an internal link to today’s Daily Note.
/tomorrow Tomorrow’s date. Gives an internal link to tomorrow’s Daily Note.
/yesterday Yesterday’s date. Gives an internal link to yesterday’s Daily Note.

Visualizing blocks

Roam is a text editor first and foremost, but sometimes thinking is easier when done spatially. There are currently three documented ways to visualize blocks of text (there’s a fourth one (Mermaid), covered in the undocumented shortcodes section below).

Shortcode Description
{{[[diagram]]}} Diagram. Adds an empty diagram block to the page. You can simply add blocks by nesting them under the block that contains the diagram, or you can double-click on the diagram canvas to add a new block.

Diagrams can be connected with lines and arrows; simply hold the Ctrl key (Windows) or Option key (macOS) while dragging your mouse from one block to another (on the diagram canvas).

{{[[table]]}} Table. Adds a table (rows and columns) to the block where this shortcode is written. Blocks directly nested under the table block are used for rows; blocks nested under row blocks become columns.

You cannot manipulate text in a table directly—for that you need to edit the blocks nested under the table. An exception is the TODO checkbox; that you can check/uncheck in the table.

{{[[kanban]]}} Kanban board. Adds a kanban board (columns with cards) to the block where this shortcode is written. Blocks nested under the kanban block are turned into columns, and blocks nested under the column blocks turn into cards.

You cannot manipulate text in a table directly—for that you need to edit the blocks nested under the kanban board. However, you can drag cards from one column to another, directly on the kanban board.

Undocumented shortcodes

Roam is constantly in flux and new shortcodes are added regularly. While the Roam team works on a new function, Roam users are already able to use it, even though it’s not documented.

These are a few of the undocumented shortcodes that we love and use regularly. This list will change as the Roam team documents functions and adds new undocumented ones.

Shortcode Description
{{character-count}}

Will be phased out

Character count. Shows a counter that adds up all characters in the block and nested blocks. Remember: {{character-count}} also counts the code in the blocks, so 19 characters are added simply by calling the function.

One use case we like for this function is to draft tweets in Roam. Simply keep the counter below 299 characters (280 character Twitter limit + 19 characters for calling the character count function).

{{count}} Character count. According to some tweets by Conor White-Sullivan (Roam’s co-founder), {{character-count}} will be phased out and {{count}} is the function to use from now on.

{{count}} does not add non-code characters to the counter as {{character-count}} does, and it shows the counter next to rather than within the block.

{{mermaid}} Mermaid diagram. Mermaid is a markup language for drawing diagrams with plain text. You can discover how to use this function by reading the Mermaid documentation.
{{or: }} Dropdown menu. After the colon (:), place the dropdown values, separated by a pipe symbol (|). For information, see the knowledge base article on dropdown menus.

Was this helpful?