组织模式在源代码块中插入链接

an *_*use 5 emacs publish org-mode

我想在组织模式源代码块的源代码注释中插入一个链接。例如:

#+BEGIN_SRC emacs-lisp
 ;this is the comment part, I want to insert a clickable link here.
#+END_SRC 
Run Code Online (Sandbox Code Playgroud)

我尝试过src_org{[[link][description]]},但这不起作用。

Chr*_*ris 1

组织模式可点击链接通常使用C-c C-o( org-open-at-point) 或用鼠标单击链接 ( org-open-at-mouse) 来激活。请注意,这两个命令都不是特定于 URL 的。与大多数 Org 一样,它们的功能取决于其使用上下文。在代码块内,这些命令执行代码块。

src_<language>{}联代码块语法不能用于将 Org 代码嵌入代码块内。

一种解决方法是使用browse-urlwhile point 位于您要访问的 URL 上:

;; Does something interesting, see http://google.com/
;;                                 ^^^^^^^^^^^^^^^^^^
;;                         With point at any of these positions
Run Code Online (Sandbox Code Playgroud)

当然,您可以将此命令绑定到您想要的任何键。

C-h f browse-url

要求 WWW 浏览器加载 URL。

提示输入 URL,默认为点或之前的 URL。变量browse-url-browser-function表示要使用哪个浏览器。如果 URL 是 mailto: URL,请browse-url-mailto-function首先查阅(如果存在)。