diff --git a/lisp/org-roam-links.el b/lisp/org-roam-links.el index 48e200e..cc1610d 100644 --- a/lisp/org-roam-links.el +++ b/lisp/org-roam-links.el @@ -110,12 +110,7 @@ When called interactively, prompt the user for MAX-DEPTH." (if (equal id start-node-id) (magit-cancel-section) (let* ((seen-p (gethash id seen-ids)) - (face - (cond - ((zerop depth) 'magit-section-heading) - (seen-p 'font-lock-comment-face) - (t 'org-roam-title))) - (heading (propertize (org-roam-node-title node) 'font-lock-face face))) + (heading (funcall org-roam-review-title-formatter node))) (magit-insert-heading (org-roam-review-indent-string heading depth)) (unless seen-p (puthash id t seen-ids) diff --git a/lisp/org-roam-review.el b/lisp/org-roam-review.el index 11c1da3..f6a0581 100644 --- a/lisp/org-roam-review.el +++ b/lisp/org-roam-review.el @@ -90,6 +90,13 @@ :group 'org-roam-review :type 'boolean) +(defcustom org-roam-review-title-formatter #'org-roam-review-default-title-formatter + "Function that renders node title in review buffers. + +It must take a node and return a (possibly propertized) string." + :group 'org-roam-review + :type 'function) + (defface org-roam-review-instructions '((t (:inherit font-lock-comment-face))) @@ -364,11 +371,14 @@ When called with a `C-u' prefix arg, clear the current filter." (insert formatted-preview) (insert "\n\n")))) +(defun org-roam-review-default-title-formatter (node) + (propertize (org-roam-node-title node) + 'font-lock-face 'magit-section-secondary-heading)) + (defun org-roam-review--insert-node (node) (atomic-change-group (magit-insert-section section (org-roam-node-section (org-roam-node-id node) t) - (magit-insert-heading (propertize (org-roam-node-title node) - 'font-lock-face 'magit-section-secondary-heading)) + (magit-insert-heading (funcall org-roam-review-title-formatter node)) (oset section node node) ;; KLUDGE: Mofified macro-expansion of `magit-insert-section-body' that ;; avoids unsetting the parent section's keymap. diff --git a/lisp/org-roam-search.el b/lisp/org-roam-search.el index 3c7050e..554f4ff 100644 --- a/lisp/org-roam-search.el +++ b/lisp/org-roam-search.el @@ -225,11 +225,10 @@ QUERY is a PRCE regexp string that will be passed to ripgrep." (pcase-dolist (`(,_file . ,group) (seq-group-by #'org-roam-node-file nodes)) (when-let* ((top-node (-max-by (-on #'< #'org-roam-node-level) group) ) - (node-id (org-roam-node-id top-node)) - (heading (org-link-display-format (org-roam-node-title top-node)))) + (node-id (org-roam-node-id top-node))) (magit-insert-section section (org-roam-node-section node-id t) (magit-insert-heading - (concat (propertize heading 'font-lock-face 'magit-section-heading) + (concat (funcall org-roam-review-title-formatter top-node) " " (when-let* ((mat (org-roam-review-node-maturity top-node))) (alist-get mat org-roam-review-maturity-emoji-alist nil nil #'equal))))