3

Is it possible to embed an html file within an html exported from org-mode?

I don't mean to "quote" the source of the file (which is possible with #+INCLUDE: "someFile.html" src html).

My use case is: I have a standalone html containing a simple D3 visualization. I'd love to link somehow to this html within org-mode so that once I export the org file, the visualization would dispay in the output html.

My current workarounds:

  1. simple linking to the standalone html [[file:...]] so the visualization opens when user clicks on it.

  2. Alternative is is to manually copy the code into the output html from org-mode - but this is highly impractical.

Thank you very much!

2 Answers 2

4

#+INCLUDE: "someFile.html" html should result in an included rendered version of the html file and not just "quote the source file".

3
  • 1
    This is correct! I was trying #+INCLUDE: "someFile.html" src html. Without "src" it embeds. Amazing! BTW: there is a colon ":" after INCLUDE.
    – user673592
    Apr 4, 2016 at 14:55
  • Sorry - one more question: after export org-mode replaces the INCLUDE with a html source block. Is it possible to prevent this? The target html might change and I'd like org-mode always fetch the actual version at the time of export. Is this possible?
    – user673592
    Apr 4, 2016 at 14:59
  • @user673592: thanks for hinting the missing colon! I've fixed that mistake. To your question: I don't actually see the behavior that the include statement in the org file is replaced with the source code. I'm using org-html-export-to-html for my testing and after exporting, the include statement is unchanged. Apr 4, 2016 at 15:27
2

In my current org version 9.0.10, the right command is

#+INCLUDE: "someFile.html" export html

with the word export.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.