diff --git a/org-roam-db.el b/org-roam-db.el index ebf2d4e..93f2ad6 100644 --- a/org-roam-db.el +++ b/org-roam-db.el @@ -563,12 +563,18 @@ INFO is the org-element parsed buffer." "Insert link data for LINK at current point into the Org-roam cache." (save-excursion (goto-char (org-element-property :begin link)) - (let ((type (org-element-property :type link)) - (path (org-element-property :path link)) - (source (org-roam-id-at-point)) - (properties (list :outline (ignore-errors - ;; This can error if link is not under any headline - (org-get-outline-path 'with-self 'use-cache))))) + (let* ((type (org-element-property :type link)) + (path (org-element-property :path link)) + (option (and (string-match "::\\(.*\\)\\'" path) + (match-string 1 path))) + (path (if (not option) path + (substring path 0 (match-beginning 0)))) + (source (org-roam-id-at-point)) + (properties (list :outline (ignore-errors + ;; This can error if link is not under any headline + (org-get-outline-path 'with-self 'use-cache)))) + (properties (if option (plist-put properties :search-option option) + properties))) ;; For Org-ref links, we need to split the path into the cite keys (when (and source path) (if (and (boundp 'org-ref-cite-types)