org-roam-server icon indicating copy to clipboard operation
org-roam-server copied to clipboard

Is there a way to display figures when previewing a note?

Open roiholtzman opened this issue 3 years ago • 7 comments

I was wondering if a link to a figure (such as a pdf plot) can be shown in the preview of a note.

roiholtzman avatar Sep 14 '20 08:09 roiholtzman

Figures are shown if they are images(png, jpg, etc.). If they are pdfs, unfortunately they are not shown directly. You can set org-roam-server-serve-files to t and then you can click the pdf links to open them in another tab.

goktug97 avatar Sep 14 '20 15:09 goktug97

Thanks. Should I do it like that (setq org-roam-server-serve-files t)? I also tried (setq org-roam-server-serve-files 't) But these don't open a link of the form file:///Users/roi/Dropbox/figure.pdf.

roiholtzman avatar Sep 14 '20 16:09 roiholtzman

This

(setq org-roam-server-serve-files t)

should work. When you set it to t, it shouldn't show file: when you hover to the link but rather it should show 127.0.0.1:8080/<a_random_string>. Can you close and reopen http://127.0.0.1:8080 after setting the variable.

goktug97 avatar Sep 14 '20 16:09 goktug97

Also you might have extra / in your link. It should be [[file:/Users/roi/Dropbox/figure.pdf][Description]]

goktug97 avatar Sep 14 '20 16:09 goktug97

The way I add the figure is by a link of the form [[~/Dropbox/figure.pdf]] What is shown in the html in the preview of the note is a link with the string file:///Users/roi/Dropbox/figure.pdf

This still does not work...

roiholtzman avatar Sep 14 '20 16:09 roiholtzman

if it is shown like that it means it is not served. Did you set org-roam-served-file-extensions? It is set to serve pdfs by default but if you changed it, it won't serve pdfs.

goktug97 avatar Sep 14 '20 17:09 goktug97

I have this set org-roam-server-served-file-extensions '("pdf" "mp4" "ogv") If it helps: When I export the org file to a pdf file using latex, then the pdf is found and exported.

roiholtzman avatar Sep 14 '20 17:09 roiholtzman