Reputation: 3846
I have a .rst
page that I am rendering. I would like to create an IFrame
in it containing an example.html
page from the same directory, or find some similar alternative way of hosting the HTML
on the page. What is the easiest way of achieving this?
I've tried a couple of approaches so far. (1):
.. include:: ./example.html
This renders the HTML as if it were a text file.
(2):
.. raw:: html
<iframe src="./example.html" marginwidth="0" marginheight="0" scrolling="no" style="width:960px; height:600px; border:0; overflow:hidden;">
</iframe>
This results in an embedded 404 page (but will it display properly once I get everything server-hosted?).
Upvotes: 1
Views: 973
Reputation: 11
Another approach:
In your conf.py
add the directory containing the .html
file as a static path:
html_static_path = ['path/to/my/html/dir']
Then when you build the html
target the .html
files will be put into the _static
directory at the root of the build folder. You can then include the html as:
.. raw:: html
<div style="text-align: center;">
<iframe src="relative/path/to/_static/myfile.html" style="width: 50%; height: 700px; border: none;"></iframe>
</div>
Upvotes: 1
Reputation: 229
I suggest using the include file directive, then in the html file you are including, use:
.. raw:: html
html content
Upvotes: 3