Next: The capture protocol, Up: Protocols for External Access   [Contents][Index]


17.16.1 The store-link protocol ¶

使用 store-link 处理器可复制链接,之后可通过 M-x org-insert-link 或粘贴操作插入。具体来说,执行命令:

emacsclient "org-protocol://store-link?url=URL&title=TITLE"

会存储如下格式的链接:

[[URL][TITLE]]

此外,URL 会被存入剪切板环(kill-ring)以供粘贴。 如果 URL 和 TITLE 中包含斜杠,则需要对其进行编码,并且通常还需要为 Shell 环境添加引号。

若要从浏览器中使用该功能,请新建一个书签并指定任意名称,例如 ‘Org: store-link’ ,然后将以下内容填入地址 Location 栏:

javascript:location.href='org-protocol://store-link?' +
      new URLSearchParams({url:location.href, title:document.title});void(0);

标题为可选参数。早期推荐使用如下写法:

javascript:location.href='org-protocol://store-link?url='+
      encodeURIComponent(location.href);void(0);

后一种写法兼容 9.0 至 9.4 版本的旧版 Org。