mirror of
https://github.com/org-roam/org-roam
synced 2025-08-01 12:17:21 -05:00
graph: add an option of wrapping the title (#542)
Co-authored-by: Jethro Kuan <jethrokuan95@gmail.com>
This commit is contained in:
committed by
GitHub
parent
1ad3539c54
commit
a8e2544435
@ -97,6 +97,19 @@ Example:
|
|||||||
:type 'number
|
:type 'number
|
||||||
:group 'org-roam)
|
:group 'org-roam)
|
||||||
|
|
||||||
|
(defcustom org-roam-graph-shorten-titles 'truncate
|
||||||
|
"Determines how long titles appear in graph nodes.
|
||||||
|
Recognized values are the symbols `truncate' and `wrap', in which
|
||||||
|
cases the title will be truncated or wrapped, respectively, if it
|
||||||
|
is longer than `org-roam-graph-max-title-length'.
|
||||||
|
|
||||||
|
All other values including nil will have no effect."
|
||||||
|
:type '(choice
|
||||||
|
(const :tag "truncate" truncate)
|
||||||
|
(const :tag "wrap" wrap)
|
||||||
|
(const :tag "no" nil))
|
||||||
|
:group 'org-roam)
|
||||||
|
|
||||||
(defcustom org-roam-graph-exclude-matcher nil
|
(defcustom org-roam-graph-exclude-matcher nil
|
||||||
"Matcher for excluding nodes from the generated graph.
|
"Matcher for excluding nodes from the generated graph.
|
||||||
Any nodes and links for file paths matching this string is
|
Any nodes and links for file paths matching this string is
|
||||||
@ -178,7 +191,10 @@ into a digraph."
|
|||||||
(let* ((file (xml-escape-string (car node)))
|
(let* ((file (xml-escape-string (car node)))
|
||||||
(title (or (caadr node)
|
(title (or (caadr node)
|
||||||
(org-roam--path-to-slug file)))
|
(org-roam--path-to-slug file)))
|
||||||
(shortened-title (s-truncate org-roam-graph-max-title-length title))
|
(shortened-title (pcase org-roam-graph-shorten-titles
|
||||||
|
(`truncate (s-truncate org-roam-graph-max-title-length title))
|
||||||
|
(`wrap (s-word-wrap org-roam-graph-max-title-length title))
|
||||||
|
(_ title)))
|
||||||
(node-properties
|
(node-properties
|
||||||
`(("label" . ,(s-replace "\"" "\\\"" shortened-title))
|
`(("label" . ,(s-replace "\"" "\\\"" shortened-title))
|
||||||
("URL" . ,(concat "org-protocol://roam-file?file=" (url-hexify-string file)))
|
("URL" . ,(concat "org-protocol://roam-file?file=" (url-hexify-string file)))
|
||||||
|
Reference in New Issue
Block a user