Skip to content

Support multi-line org titles#2264

Merged
jethrokuan merged 3 commits intoorg-roam:mainfrom
FelixBrendel:fix/multi-line-org-titles
Dec 2, 2022
Merged

Support multi-line org titles#2264
jethrokuan merged 3 commits intoorg-roam:mainfrom
FelixBrendel:fix/multi-line-org-titles

Conversation

@FelixBrendel
Copy link
Contributor

org-mode allows multi-line titles, for example:

#+title: Spatiotemporal Variance-Guided Filtering:
#+title: Real-Time Reconstruction for Path-Traced Global Illumination

This helps with legibility. When exporting, org joins the multiple lines with a space as separator to produce the final title for the exported document.

Until now this functionality does not seem to be supported by org-roam. Only the first line will be used as the title.

I have to admit, I am not a elisp expert but I managed to narrow the problem down to the org-roam-db--file-title (thanks to its very hepful docstring!).

(defun org-roam-db--file-title ()
  "In current Org buffer, get the title.
If there is no title, return the file name relative to
`org-roam-directory'."
  (org-link-display-format
   (or (cadr (assoc "TITLE" (org-collect-keywords '("title"))))
       (file-name-sans-extension (file-relative-name
                                  (buffer-file-name (buffer-base-buffer))
                                  org-roam-directory)))))

I found out that (assoc "TITLE" (org-collect-keywords '("title"))) returns a list of the title lines. When joined via string-join it was consistent with default org behaviour. I also found out string-join was part of subr-x (so it might not be available by default?) but I noticed it was already used in org-roam.el, so this shouldn't bring in new dependencies.

However, I can't gurantee that other parts of the code have to be touched to accomodate this change, maybe someone with more experience with the org-roam code base could take a look at this?

@jethrokuan jethrokuan self-requested a review December 2, 2022 07:56
@jethrokuan jethrokuan merged commit 05f6790 into org-roam:main Dec 2, 2022
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 7, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants