Files
org-roam/manual/The-roam_002dref-Protocol.html
2020-05-13 11:45:38 +00:00

104 lines
4.4 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<!-- Copyright (C) 2020-2020 Jethro Kuan <jethrokuan95@gmail.com>
You can redistribute this document and/or modify it under the terms
of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any
later version.
This document is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
-->
<!-- Created by GNU Texinfo 6.5, http://www.gnu.org/software/texinfo/ -->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>The roam-ref Protocol (Org-roam User Manual)</title>
<meta name="description" content="The roam-ref Protocol (Org-roam User Manual)">
<meta name="keywords" content="The roam-ref Protocol (Org-roam User Manual)">
<meta name="resource-type" content="document">
<meta name="distribution" content="global">
<meta name="Generator" content="makeinfo">
<link href="index.html#Top" rel="start" title="Top">
<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
<link href="Roam-Protocol.html#Roam-Protocol" rel="up" title="Roam Protocol">
<link href="Diagnosing-and-Repairing-Files.html#Diagnosing-and-Repairing-Files" rel="next" title="Diagnosing and Repairing Files">
<link href="The-roam_002dfile-protocol.html#The-roam_002dfile-protocol" rel="prev" title="The roam-file protocol">
<style type="text/css">
<!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
blockquote.smallindentedblock {margin-right: 0em; font-size: smaller}
blockquote.smallquotation {font-size: smaller}
div.display {margin-left: 3.2em}
div.example {margin-left: 3.2em}
div.lisp {margin-left: 3.2em}
div.smalldisplay {margin-left: 3.2em}
div.smallexample {margin-left: 3.2em}
div.smalllisp {margin-left: 3.2em}
kbd {font-style: oblique}
pre.display {font-family: inherit}
pre.format {font-family: inherit}
pre.menu-comment {font-family: serif}
pre.menu-preformatted {font-family: serif}
pre.smalldisplay {font-family: inherit; font-size: smaller}
pre.smallexample {font-size: smaller}
pre.smallformat {font-family: inherit; font-size: smaller}
pre.smalllisp {font-size: smaller}
span.nolinebreak {white-space: nowrap}
span.roman {font-family: initial; font-weight: normal}
span.sansserif {font-family: sans-serif; font-weight: normal}
ul.no-bullet {list-style: none}
-->
</style>
</head>
<body lang="en">
<a name="The-roam_002dref-Protocol"></a>
<div class="header">
<p>
Previous: <a href="The-roam_002dfile-protocol.html#The-roam_002dfile-protocol" accesskey="p" rel="prev">The &lsquo;<samp>roam-file</samp>&rsquo; protocol</a>, Up: <a href="Roam-Protocol.html#Roam-Protocol" accesskey="u" rel="up">Roam Protocol</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>]</p>
</div>
<hr>
<a name="The-roam_002dref-Protocol-1"></a>
<h3 class="section">11.3 The &lsquo;<samp>roam-ref</samp>&rsquo; Protocol</h3>
<p>This protocol finds or creates a new note with a given &lsquo;<samp>ROAM_KEY</samp>&rsquo; (see <a href="Anatomy-of-an-Org_002droam-File.html#Anatomy-of-an-Org_002droam-File">Anatomy of an Org-roam File</a>):
</p>
<img src="images/roam-ref.gif" alt="images/roam-ref">
<p>To use this, create a Firefox bookmarklet as follows:
</p>
<div class="example">
<pre class="example">javascript:location.href =
'org-protocol://roam-ref?template=r&amp;ref='
+ encodeURIComponent(location.href)
+ '&amp;title='
+ encodeURIComponent(document.title)
</pre></div>
<p>or as a keybinding in &lsquo;<samp>qutebrowser</samp>&rsquo;, adding the following to the &lsquo;<samp>autoconfig.yml</samp>&rsquo; file:
</p>
<div class="example">
<pre class="example">settings:
bindings.commands:
global:
normal:
gc: open javascript:void(location.href='org-protocol://roam-ref?template=r&amp;ref='+encodeURIComponent(location.href)+'&amp;title='+encodeURIComponent(document.title))
</pre></div>
<p>where &lsquo;<samp>template</samp>&rsquo; is the template key for a template in
&lsquo;<samp>org-roam-capture-ref-templates</samp>&rsquo; (see <a href="The-Templating-System.html#The-Templating-System">The Templating System</a>). These templates
should contain a &lsquo;<samp>#+ROAM_KEY: ${ref}</samp>&rsquo; in it.
</p>
</body>
</html>