Roam Research Users unite!

It looks like quite a few ROAM Research users are picking up Text Blaze to use with ROAM for a variety of things, from making soft line-breaks to creating templates etc.

Let's get all the ROAM Research users on this thread and share ideas/snippets for combining TB with RR to make everyone's life easier. If there's enough material, I'll be more than happy to create a MEGA guide for everyone's benefit.

C'mon, let's see what you've got! :grin:

UPDATED - Nov 28, 2020

I'm adding the Roam journaling video below as it belongs to this topic.

5 Likes

I use Text Blaze a lot to autofill pages (Daily notes, articles, etc.). One fun template I use is for YouTube videos. It grabs and autofills the title and creator and wraps them in double brackets, and the URL (you could easily wrap the URL in the Roam-style YouTube embed).

{urlload: {clipboard}; done=(contents, status)->["contents"=contents, "status"=status]} Title:: [[ {=extractregex({=contents}, "<metaname=\"title\" content=\"(.+?)\">")} ]] {key:enter}{key:tab} Creator:: [[ {=extractregex({=contents}, "\"author\":\"(.+?)\"")} ]] {key:enter} URL:: {clipboard}{key:enter} Tags:: #Video {key:enter} Notes: {key:enter}{key:tab}

1 Like

@Jimmy_Jamboree, that's some pretty Jedi stuff you did there :grin:

The forum messed up your code a bit, so Scott stepped in and tried to fix it. I've tested it, but for "title" I'm getting a no-match. Maybe we're missing something. Can you double-check please?

Oops. I realized I was a bit hasty with my description! You need to have the URL for the YouTube video in your clipboard (but that may have been clear from the snippet).

I'm trying to copy in the code again (but I'm noticing issues with how the backslashes are showing up):

{urlload: {clipboard}; done=(contents, status)->["contents"=contents, "status"=status]}Title:: [[{=extractregex({=contents}, "<meta name="title" content="(.+?)">")}]]{key:enter}{key:tab}Creator:: [[{=extractregex({=contents}, "\\"author\\":\\"(.+?)\\"")}]]{key:enter}URL:: {clipboard}{key:enter}Tags:: #Video {key:enter}Notes:{key:enter}{key:tab}

Here's a screenshot of the code, which is working fine for me, and a preview:

Hi Jimmy,

"\" is a special character in this forum software, so every time you use it in a snippet here you need to put another backlash in front of each "\"

So if your snippet has \", you need to put it into the forums here as \\".

Ok, so here's what it's supposed to look like:

{urlload: {clipboard}; done=(contents, status)->["contents"=contents, "status"=status]}Title:: [[{=extractregex({=contents}, "<meta name=\"title\" content=\"(.+?)\">")}]]{key:enter}{key:tab}Creator:: [[{=extractregex({=contents}, "\\\\\"author\\\\\":\\\\\"(.+?)\\\\\"")}]]{key:enter}URL:: {clipboard}{key:enter}Tags:: #Video {key:enter}Notes:{key:enter}{key:tab}

Thanks for sharing! :slight_smile:

@scott any idea why it's saying "Cannot preview URLload commands"?

The forum doesn't allow previewing some commands like {urlload} in the forum. You can copy the snippet to Text Blaze if you want to try them out.

1 Like

Ah ok, I thought I was messing something up on my end. Thanks.

This is amazing. I love it.
My metadata macros were much simpler:

Articles:
Author:: {key:enter}Reading Status::{key:enter}Date Finished::{key:enter}Recommended:: {key:enter}Why:: {key:enter}Tags:: #booklist {key:enter}Notes::{key:enter}
People:
Phone Number::{key:enter}Email::{key:enter}Company::{key:enter}Role::{key:enter}Introduced by::{key:enter}Location::{key:enter}Birthday::{key:enter}How we met::{key:enter}Interests::{key:enter}Tags:: #people
Books:
Author::{key:enter}Reading Status::{key:enter}Date Finished::{key:enter}Recommended::{key:enter}Why::{key:enter}Tags:: #booklist{key:enter}Notes::
Videos:
Speaker::{key:enter}Tags:: #video {key:enter}Summary::{key:enter}Link or Embed::

5 Likes

@Benjamin_Von_Wong, how do you populate the fields then? Do you do it manually? You could use {formtext}, {formparagraph} and {formmenu} for that.

P.S. for the {formparagraph} command with multi-select, you can specify the separator, so if the comma doesn't work, let me know and I'll show you how you can change it accordingly.

Here's an example:

Articles:
Author:: {key:enter}Reading Status::{formmenu: To read; In progress; On hold; Finished}{key:enter}Date Finished::{key:enter}Recommended:: {key:enter}Why:: {key:enter}Tags:: {formmenu: multiple=yes; #booklist; #fiction; #non-fiction; # business; #psychology; #action}{key:enter}Notes::{key:enter}

Also, this video might come in handy:

I'm on a free account, but thank you ! In Roam. information is generally filled out over time, not at one point so a form is cool but unnecessary! Thanks though!

1 Like

That looks good. I've found that I need to have two enters - {key:enter}{key:enter} - if I add a #hashtag. Otherwise, the following lines are all joined up.

1 Like

You can also use the {clipboard} command. It's available in the free version if I'm not mistaken.

{clipboard} inputs anything that is currently in your clipboard. Try it out below:

Your clipboard currently contains the following data:
{clipboard}

@Kevin_Murray, if you ever happen to need something more than twice, there's also the repeat command. In your case, with two enters you don't really need it of course. But it's worth knowing about.

Here's where you can find more info about it: https://blaze.today/commands/repeat/

Just a small one. But here is the snippet for the "choice" tool that Conor tweeted about here:

{{[[TODO]]}} #[[Choice]] {key:enter}{key:tab}Options:: {key:enter}Decision::{key:enter} {key:shift-tab}

2 Likes

Here's an easy one for a block embed:

{{[[embed]]: (({cursor}))}}

Running this snippet will put your cursor exactly where it needs to be so you can type the block reference.

Alternatively, you can use the {clipboard} command like so:

{{[[embed]]: (({clipboard}))}}

This will put whatever you have in your clipboard inside the block embed.

1 Like

And a quick one for highlighting text.

To make this one work, highlight the text you wanna highlight, and CUT it (Ctrl+x or CMD+x) into your clipboard.

Then run this snippet:

^^{clipboard}^^

Text Blaze will paste the contents of your clipboard inside the syntax to make it highlighted.

1 Like

Hi Cedric,
I've just signed up and am experimenting with simple snippets in Roam. I am having trouble with placing a cursor at a certain spot rather than simply at the end of the snippet as per the default. The sample snippet is below. You can see where I've marked the cursor. It appears to be ignored in practice. Am I using it incorrectly?

Morning Journal #jLog
{key:enter}{key:enter}{key:tab}One thing I am [[grateful]] for:
{key:enter}{key:tab}{key:tab}{cursor}
{key:enter}{key:shift-tab} My [[intention]] for today:
{key:enter}{key:tab}

UPDATED: I've double-checked with Scott.

Unfortunately, it looks like it's not always possible to restore cursor positions across key commands. However, it's something we are working on improving. :slight_smile:

If you have the pro version, you could work around it with text fields:

Morning Journal #jLog
{key:enter}{key:enter}{key:tab}One thing I am [[grateful]] for:
{key:enter}{key:tab}{key:tab} {formtext}
{key:enter}{key:shift-tab} My [[intention]] for today:
{key:enter}{key:tab} {formtext}