Kungsgeten / org-brain

Org-mode wiki + concept-mapping
MIT License
1.72k stars 102 forks source link

Finding CUSTOM_ID of a brain (sub+)section node for HTML exports. #397

Open drawkula opened 5 months ago

drawkula commented 5 months ago

I'm (ab?)using org-brain to keep track of my notes which typically shall be glued together as bigger HTML exports.

Finding links to single file brain nodes is easy, but I'd like to find the file/CUSTOM_ID value for (sub+)section references.

So far I've only done trivial stuff in Elisp and would't even know where to search.

Kungsgeten commented 5 months ago

So you want the custom ID of a headline entry? How do you want to get it, like choosing from a list and pasting/yanking it into the buffer? If so maybe something like this:

(defun org-brain-yank-id ()
  (interactive)
  (insert (car (last (org-brain-choose-entry "Get ID of entry: "
                                             (org-brain-headline-entries) nil t)))))
drawkula commented 5 months ago

For being able to generate ™human friendly™ references in HTML exports, I need to find the CUSTOM_ID for a known ID. If all else fails, I can scan for it via AWK, but there probably is a better way.

Kungsgeten commented 5 months ago

If you know the ID you could use something like this (not related to org-brain, only using the builtin org functions):

(org-entry-properties (org-find-id "the ID of the entry") "CUSTOM_ID")