Open stharrold opened 8 years ago
For embed_html
plugin:
<div id="embed_html" data-html-path="path/to/html"></div>
Tag is from http://www.w3schools.com/tags/att_global_data.asp
find_all(name='div', attrs={'id': 'embed_html'}, content='')
tag.getattr['data-path-html']
Raise ValueError if missing key.
path/to/html
all into memory:with open(path_html) as fobj:
html_content = fobj.read()
Raise IOError if missing file.
replace_with
to insert<div id="embed_html" data-path-html="path/to/html">html_content</div>
Inline replacement avoids adding newlines as siblings to the content (http://www.crummy.com/software/BeautifulSoup/bs4/doc/#going-sideways)
embedding d3 taken care of with ipynb: http://blog.thedataincubator.com/2015/08/embedding-d3-in-an-ipython-notebook/
use <embed>
HTML5 tag
http://www.w3schools.com/tags/tag_embed.asp
<embed>
, <iframe>
, <object>
all create a separate document and do not adopt styles from host page. <iframe>
with seamless
attribute will adopt styles but is not widely supported:
For discussion, see
<div>
are supported with blank lines before and afterWith embedded ipynb as basic HTML, need CSS style or BeautifulSoup script to:
* Remove paragraph anchor marks. (e.g. <a class="anchor-link" href="#20151030_test">¶</a>
)
* Drop unwanted cells.
Future usage note:
For embedding IPYNBs, either:
* use embed_html
to embed the IPYNB basic HTML export (jupyter nbconvert --to html --template basic
)
or:
* use liquid_tags.notebook
to embed the IPYNB.
Otherwise the CSS styling from liquid_tags.notebook
's generated file _nb_header.html
will be applied to the embedded IPYNB basic HTML export. It's ok to use liquid_tags.notebook
to embed IPYNBs and use embed_html
to embed HTML files that are not IPYNB basic HTML exports.
markdown.extensions.toc
will not parse headers in embedded HTML:
<h1 id="Heading-1">Heading 1</h1>
as # Heading 1
using BeautifulSoup<div class="toc">
with <li><a href="#Heading-1">Heading 1</a></li>
using https://pythonhosted.org/Markdown/extensions/toc.htmlid
from generated <h1 id="Heading-1">Heading 1</h1>
matches the id
from input <h1 id="Heading-1">Heading 1</h1>
.
http://stackoverflow.com/questions/8988855/include-another-html-file-in-a-html-file
As an extension to liquid_tags?