If you find yourself saving lots of notes from various online articles into Roam Research, it can become tedious to format them properly to include the source. This is a simple bookmarklet that does the job for you. It works with any browser, including Chrome, Firefox and Safari. As you can see in the gif below, it can help you save snippets of content in seconds.
(if you somehow stumbled upon this page and don’t know what Roam is about, go through this tutorial first)
How to install +Roam
You can simply install the +Roam Chrome extension or the +Roam Firefox add-on.
If you’re using the Chrome extension and want to make it even more useful, go to the shortcuts page in your settings, and type either Shift+CMD+R or Shift+CTRL+R under the +Roam extension. Now you can highlight text, type the keyboard shortcut, and the pre-formatted snippet will pop up.
And if you’re using another browser, installing your own copy of +Roam is super easy. Just follow these three steps and you’ll be good to go. You can also see the source code and make any tweaks you like to accommodate your workflow.
1. Create a new bookmark. For instance, in Chrome, you should right click on the bookmarks bar and click “Add Page…”
2. Call the new bookmark +Roam then paste the following code in the URL field:
javascript:(function(){let text=""; if(window.getSelection()!=''){text=window.getSelection().toString();}prompt("Press CTRL+C or CMD+C, then escape and paste into Roam.", "%5F%5F"+text+"%5F%5F%20—%20via%20%5B"+document.title+"%5D%28"+location.href+"%29");})()
It should look something like this:
3. Save the bookmarklet and move it to your bookmarks bar.
Now, go to a page. For this quick tutorial, you can open this page in a new tab. Highlight some text, then click on +Roam in your bookmark bar. CTRL+C or CMD+C to copy the text you see in the window that pops up, press ESC to close the window, and go to Roam. Paste what you just copied into a new block, and press enter.
Voilà! The block will include the text you highlighted, as well as the source, all nicely formatted in markdown.
Keep track of clipped bookmarks
Similar to Quick Capture in Roam, you may want to sort all of your +Roam bookmarks later. This version just adds a [[+Roam]] tag to the clipped text. You can off course edit it with any tags you’d like to use instead.
javascript:(function(){let text=""; if(window.getSelection()!=''){text=window.getSelection().toString();}prompt("Press CTRL+C or CMD+C, then escape and paste into Roam.", "%5F%5F"+text+"%5F%5F%20—%20via%20%5B"+document.title+"%5D%28"+location.href+"%29%20%5B%5B%2BRoam%5D%5D");})()
That’s it! It’s just a tiny hack but it will make your life much easier if like me you like to save online articles with a bit of context or to save particular quotes with the exact source.
This extension is open source and you can find the code here if you want to fork and make some changes of your own. It was inspired by the TiddlyWiki bookmarklet by Chris Aldrich.
Finally, if you want to create your own local version of the extension with more features, you can download the repository from Github, make your changes, then in Chrome go to “extensions settings”, check “Developer mode”, click “Load unpacked extension” and select the folder. That’s it, your own version of the extension will be added to Chrome!