Browse Source

Add org-roam capture templates

master
Riyyi 4 years ago
parent
commit
6d64cb1a6a
  1. 29
      .config/emacs/config.org

29
.config/emacs/config.org

@ -402,15 +402,38 @@ Setup =org-roam=.
;; Exclude Syncthing backup directory
(setq org-roam-file-exclude-regexp "\\.stversions")
(setq org-roam-title-to-slug-function #'dot/org-roam-title-to-slug)
(setq org-roam-verbose nil))
(setq org-roam-verbose nil)
;; Templates used when creating a new file
(setq org-roam-capture-templates
'(("d" "default" plain #'org-roam-capture--get-point
"%?"
:file-name "%<%Y%m%d%H%M%S>-${slug}" :head "#+TITLE: ${title}\n#+ROAM_TAGS: %^{Roam tags}\n" :unnarrowed t))))
#+END_SRC
Enable [[https://www.orgroam.com/manual/Roam-Protocol.html#Roam-Protocol][Roam-Protocol]], needed to process =org-protocol://= links
Enable [[https://www.orgroam.com/manual.html#Roam-Protocol][Roam Protocol]], needed to process =org-protocol://= links
#+BEGIN_SRC emacs-lisp
(use-package org-roam-protocol
:ensure nil ; org-roam-protocol.el is part of org-roam
:after org-roam)
:after org-roam
:config
;; Templates used when creating a new file from a bookmark
(setq org-roam-capture-ref-templates
'(("r" "ref" plain #'org-roam-capture--get-point
"%?"
:file-name "${slug}" :head "#+TITLE: ${title}\n#+ROAM_KEY: ${ref}\n\n${body}" :unnarrowed t))))
#+END_SRC
The roam-ref protocol bookmarks to add:
#+BEGIN_SRC javascript :tangle no
javascript:location.href =
'org-protocol://roam-ref?template=r'
+ '&ref=' + encodeURIComponent(location.href)
+ '&title=' + encodeURIComponent(document.title)
+ '&body=' + encodeURIComponent(window.getSelection())
#+END_SRC
Setup =org-roam-server=.

Loading…
Cancel
Save