Add org-roam-link-id-format and org-roam-link-title-format

This allows for customizing how org-roam links look when inserted
This commit is contained in:
Jethro Kuan 2020-02-10 15:27:42 +08:00
parent 59ebbda730
commit 06890773ae

View file

@ -22,11 +22,6 @@
:type 'directory
:group 'org-roam)
(defcustom org-roam-zettel-indicator "§"
"Indicator in front of a zettel."
:type 'string
:group 'org-roam)
(defcustom org-roam-position 'right
"Position of `org-roam' buffer.
@ -47,6 +42,16 @@ Valid values are
(const title))
:group 'org-roam)
(defcustom org-roam-link-id-format "§%s"
"The format string used when inserting org-roam links that use id."
:type 'string
:group 'org-roam)
(defcustom org-roam-link-title-format "%s"
"The format string used when inserting org-roam links that use their title."
:type 'string
:group 'org-roam)
(defcustom org-roam-buffer-width 0.33 "Width of `org-roam' buffer."
:type 'number
:group 'org-roam)
@ -179,7 +184,7 @@ If `ABSOLUTE', return the absolute file-path. Else, return the relative file-pat
(make-empty-file file-path))
(insert (format "[[%s][%s]]"
(concat "file:" file-path)
title)))))
(format org-roam-link-title-format title))))))
(defun org-roam--insert-id ()
"Find `ID', and insert a relative org link to it at point."
@ -189,7 +194,7 @@ If `ABSOLUTE', return the absolute file-path. Else, return the relative file-pat
(make-empty-file file-path))
(insert (format "[[%s][%s]]"
(concat "file:" file-path)
(concat org-roam-zettel-indicator id)))))
(format org-roam-link-id-format id)))))
;;; Finding org-roam files
(defun org-roam-find-file ()