Export to pdf BUT following links


I’m looking for a way to export to PDF (or html) but including following links. It can be limited to certain depth, and it somehow needs to handle circular links I guess.

Ideally I would select parent note, which is entry point into the hierarchy and linked notes are added as seperate chapters for example, cross-referenced inside generated PDF.

From my research I did, this is maybe possible using conversion to hugo and going from there. The usual org-latex-export-to-pdf and org-html-* export just individual note.

Anyone dealt with this before?

I have not done it before but I would look in org-roam-graph functions to see if you can get a list of IDs or file names. For example, this function looks promising, though I don’t know exactly what edges return:

(defun org-roam-graph--connected-component (id distance)
  "Return the edges for all nodes reachable from/connected to ID.
DISTANCE is the maximum distance away from the root node."

There seem to be some other function or db query snippets that might be useful for your requirement.

Once you have obtained a list of IDs or file names, then it’s a matter of iterating it to call an export function for each file.