yjwen / org-reveal

Exports Org-mode contents to Reveal.js HTML presentation.
1.41k stars 247 forks source link

Image path after export #486

Open jacquesdurden opened 2 years ago

jacquesdurden commented 2 years ago

I'm used to define a specific folder for any export of an org-mode file. I set up this by following the procedure describe here. In particular, this amounts to this setting in my case

(defvar org-export-output-directory-prefix "export_" "prefix of directory used for org-mode export")
(defadvice org-export-output-file-name (before org-add-export-dir activate)
  "Modifies org-export to place exported files in a different directory"
  (when (not pub-dir)
    (setq pub-dir (concat org-export-output-directory-prefix (substring extension 1)))
    (when (not (file-directory-p pub-dir))
      (make-directory pub-dir))))

However, this configuration does not seem compatible with the way ox-reveal exports image path. So if an image "dummy.jpg" in a org-mode file is placed in the folder "tmp/" (or even "./"), the html produced by ox-reveal and placed in "export_html/" with the code above does not follow the path of this image. It points to "tmp/dummy.jpg" instead of "../tmp/dummy.jpg".

Do you know a way to solve this problem? Is it possible to tell ox-reveal where to find all images?

Thank you.

yjwen commented 1 year ago

ox-reveal has no way to know the target file name or path. It is derived from org mode HTML backed, which exports image URL as written in org file.

For the specific "../tmp/dummy.jpg" case, I would like to suggest either

  1. Use an absolute path rather than a relative one. Or
  2. Place org files in a directory with the same level of tmp/ and export/, so that both org file and the exported HTML can find the image by "../tmp/dummy.jpg"
jacquesdurden commented 1 year ago

Thanks. Would it be possible to tell org-reveal  by setting a variable? Le 27 nov. 2022, 09:09 +0100, Yujie Wen @.***>, a écrit :

ox-reveal has no way to know the target file name or path. It is derived from org mode HTML backed, which exports image URL as written in org file. For the specific "../tmp/dummy.jpg" case, I would like to suggest either

  1. Use an absolute path rather than a relative one. Or
  2. Place org files in a directory with the same level of tmp/ and export/, so that both org file and the exported HTML can find the image by "../tmp/dummy.jpg"

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>