Roam Research Users unite!

Thanks for getting back to me. No probs, I will play with text forms for now. Yup I splashed the cash on pro yesterday. Iā€™m a Linux user, so this is a great text expander for someone in that situations.

1 Like

This is great but is there a way to disable the popup form? It adds two clicks to every process and is quite annoying. It disrupts what would otherwise be a super seamless process.

Also! Is it possible to adapt this for a webpage Title and Author?

I tried with this but it doesn't work: {=extractregex({=content}, "<meta property="og:title" content="(.+?)">")}

@Benjamin_Von_Wong - The popup only shows up when your input is required, for instance when you have a text field to fill, a toggle option, or a dropdown menu. If the snippet doesn't require additional input from you, it's inserted immediately upon writing the shortcut.

For example:

This snippet won't bring up a popup.

This snippet will bring up a popup because you need to fill in this text field: {formtext}

@Benjamin_Von_Wong

I think this is what you're looking for

{url={formtext: default=clipboard}}

{urlload: {=url}; done=(res) -> ["all"=catch(extractregex(res, "[\D \S]+"), "???"), "title"=catch(extractregex(res, "(.+?)"), "???")]}

Title: {=title}

Of course you can remove the first line and go directly with

{urlload: {clipboard};

Like this, you can copy the url to your computer clipboard and Text Blaze will read it directly from there without showing you any popups.

I also use a little tactic to avoid having to escape special characters.

{url="https://yoururl"}
{start="your opening string"}
{close="your closing string"}

{urlload: {=url}; done=(res) -> ["segment"=catch(extractregex(res, start & "([\D \S]+)" & stop), "???")]}

segment: {=segment}

hey @cedricdebono thanks for taking the time to reply. I can't seem to get either one of your codes to work?

Both the URL=Formtext and URLLoad commands appear as errors for me (invalid command) I've played around with the syntax but can't quite seem to figure it out.

I'm also not quite sure how the special character piece fits into the rest? Sorry, a little bit of a newbie here.

--

If I use {urlload: {=clipboard}; the error I get is Unknown name "clipboard"
If I use {urlload: {clipboard}; I get InvalidURL.

Not sure what I'm doing wrong here >.<

I tried this and it seems to load the URL ... but the output is always <

{urlload: {clipboard}; done=(res) -> ["all"=catch(extractregex(res, "[\D \S]+"), "???"), "title"=catch(extractregex(res, "(.+?)"), "???")]}

Title: {=title}

I'm using this code snippet and the form pops up even though there's no form entry required!

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

@Benjamin_Von_Wong - not all websites will have a <meta name="title" content=" section.

Can you give me a specific website you're trying this with? That way I can make sure we're on the same page.

In the meantime, try this:

{url={clipboard}}
{open="<meta name=\"title\" content=\""}{=open}
{close="\">"}{=close}

{urlload: {=url}; done=(res) -> ["all"=catch(extractregex(res, "([\D \S]+)"), "???"), "segment"=catch(extractregex(res, open & "([\D \S]+)" & stop), "???")]}

segment: {=segment}

all: {=all}

Notice that when defining the open and close variables I'm using backslashes to escape quotation marks.
I've also put the {=open} and {=close} so that you can check that they're being assembled properly.

Honestly I'm hoping to craft something that will work for any website, but just for starter's a medium post:
https://medium.com/impact-everywhere/royce-mann-privilege-podcast-6cf739aabb36?source=collection_home---4------0-----------------------
or just a standard news outlet:

While the code seems to "load" i still can't figure out how to get it to output Title and Author blocks properly?

Currently Segment:: ???

So basically my problem is figuring out how to configure the REGEX code to extract and Author of every standard page by taking it from the metadata.

I think the standard woudl be follow Facebook's OG graph: property="og:title" ?

--

Basically, you know how every browser has "Text" on the tab? That Text would be ideal to pull out. Author is less important!

As I said, not all websites use the exact same syntax for the opening title tag.

That said, you could probably try finding the tag and going backwards. I'm not sure about the parameters for that, but I believe it's possible. Maybe @scott has some advice about it. He's much better than I am at this stuff :laughing:

If you are using a snippet in a page, you can use {site: title} to get the title of that page.

If you are using {urlload}, then you will have to use a regular expression for the title and author. However, as you are discovering, doing this in a general way is quite difficult.

The "meta" tags are optional and many pages won't include them at all. For those that do, they will often be in many different forms. Frankly, I think it may not be feasible to do this in a general way.

Here is a thread from a quick Google search that may be helpful:

Oh darn. Is there no way to combine the two? "urlload a Site Title?"
Essentially what I'm trying to do is easily paste a pre-formatted URL into Roam Research (which is itself a web app) so Site:Title within the site itself doesn't quite work...

Gonna keep poking around the Regex you shared on that link: /<meta[^>]*name=["']description["'][^>]content="'["'][^>]>/i

Hi and sorry for the late reply.

Unfortunately, you can't combine {site:title} with {urlload}

That said, you could run the snippet on the website you want, using the {site:title} command, format them in a specific way, then copy the contents from the popup window and run another snippet on ROAM that uses extractregex to pull the contents from the clipboard.

It's a bit convoluted, but it should work. If my explanation is confusing, let me know and I'll go into more detail.

1 Like

Over the past day I've found that my TextBlaze snippet is not creating line breaks with text that includes a hashtag.

So this template:
Meta{key:ctrl-alt-3}{key:enter}{key:tab}Tags:: #person{key:enter}{key:enter}Contact::{key:enter}Links::{key:enter}Date created:: [[{time: MMMM Do, YYYY}]]{key:enter}{key:enter}:hiccup [:hr]{key:enter}

Leads to:
Tags:: #personContact::Links::Date created:: [[August 29th, 2020]]

It isn't a problem if I take the hashtag out.

Has anyone else encountered this problem?

1 Like

It looks like Roam is popping up an autocomplete menu after the hashtag field.

It looks like you should be able to address this by adding a space between the hashtag and the {key:enter}:

For example:

Meta{key:ctrl-alt-3}{key:enter}{key:tab}Tags:: #person {key:enter}{key:enter}Contact::{key:enter}Links::{key:enter}Date created:: [[{time: MMMM Do, YYYY}]]{key:enter}{key:enter}:hiccup [:hr]{key:enter}

1 Like

Thanks. That works now.

1 Like

Hi all,

I was hoping you all could help me with a question about how to better support Roam users.

Text Blaze has commands like {key} or {click} or {formtext}. We're considering adding additional commands that are specific for Roam.

If we were to develop these Roam-specific commands what type of commands would be useful?

For example, I am thinking of things like adding support for the following in a snippet:

{roam-header: YOUR HEADER HERE}

which would be equivalent to:

# YOUR HEADER HERE{key:enter}

These commands would take things that were doable but verbose in Text Blaze today and make the simpler and easier to use.

Let us know if you are interested in this and have an ideas for Roam commands.

3 Likes

I have created a snippet that lets me input a form field with a variable number of inputs. I use it for creating a list of keywords. The use of the repeat command feels clumsy here. I have to input each keyword into the note separated by a comma, and the snippet will merely repeat each keyword. I can't format them individually, for instance. Perhaps roam users would benefit from a variable form command, which lets you input n number of form fields and then operates differently based on which forms are filled. Or is there a way to do this already with nesting? Basically, I want to be able to input any number of form fields and treat each one differently.

Here is my snippet for creating a list of keywords:

Keywords:: {note}{formtext: name=keywords; default=}{endnote}{repeat: for keyword in split(keywords, ",")} #{=keyword} {endrepeat: trim=left}

2 Likes

So something like a {roam-keywords: cat, dog, parrot} command that maps to: #cat #dog #parrot? That is definitely doable.

What else would be helpful?

As a side note, you could use the formatter setting to remove the need for {repeat} above.

Below we're using split() like you do above to convert the keywords to a list, map() to add a hashtag to each keyword (and trim any excess whitespace) and then join() to bring everything back together with each keyword separated by a space.

Keywords: {formtext: name=keywords; formatter=ks -> join(map(split(ks, ","), k -> "#" & trim(k)), " ")}

3 Likes

I think if you had a way of coding "enter", indent, and reverse-indentation that would make the code a lot less verbose.

So if it were hypothetically:
{Roam-code: line1, line2, +, line3 ,-, line 4, line 5} or something similar it would be so much cleaner to navigate.

I'd love a date-calculator conversion tool also. Roam can't do date calculations so if you could do a date calculation within Textblaze that converts to a Roam "Date block" that would be super helpful.

I'm also not sure if textblaze has plans for this but generally speaking Roam is all about ingesting data, so anything that compensates for its lack of API would be helpful (interfacing between calendar/email/etc... through textblaze into Roam) would be great.

Daily Pages{key:ctrl-alt-1}{key:enter}{key:tab}[[:two_hearts:Connections Created]]{key:enter}[[:open_book:Content Consumed]]{key:enter}[[:bulb:Project Progress]]{key:enter}{key:shift-tab}Morning Routine{key:ctrl-alt-1}{key:enter}{key:tab}[[Daily Affirmations]]{key:enter}[[Daily Pushups]]:{key:ctrl-enter}{key:enter}[[Morning Pages]] {{word-count}}{key:enter}[[What would make today great?]]{key:enter}Evening Routine{key:ctrl-alt-1}{key:shift-tab}{key:enter}{key:tab}[[Evening Reflections]]{key:enter}[[What compliment did I receive]]{key:enter}Plan for /tomorrow{key:enter}{key:enter}[[What do I want my mind to work on tonight?]] {key:enter}Retrospective{key:ctrl-alt-1}{key:shift-tab}{key:enter}{key:tab};1 week ago{key:enter};2 weeks ago{key:enter};4 weeks ago{key:enter};6 weeks ago

1 Like