MCPcopy
hub / github.com/python-visualization/folium / get_notebook_html

Function get_notebook_html

tests/selenium/test_selenium.py:42–64  ·  view source on GitHub ↗

Convert markdown to notebook to html files, remove them when done.

(filepath_notebook)

Source from the content-addressed store, hash-verified

40
41
42def get_notebook_html(filepath_notebook):
43 """Convert markdown to notebook to html files, remove them when done."""
44 subprocess.run(
45 [
46 "jupytext",
47 "--to",
48 "notebook",
49 "--execute",
50 filepath_notebook,
51 ]
52 )
53 filepath_notebook = filepath_notebook.replace(".md", ".ipynb")
54
55 html_exporter = nbconvert.HTMLExporter()
56 body, _ = html_exporter.from_filename(filepath_notebook)
57
58 parser = IframeParser()
59 parser.feed(body)
60 iframes = parser.iframes
61
62 for iframe in iframes:
63 with temp_html_filepath(iframe) as filepath_html:
64 yield filepath_html
65
66
67class IframeParser(HTMLParser):

Callers 1

test_notebookFunction · 0.85

Calls 2

temp_html_filepathFunction · 0.90
IframeParserClass · 0.85

Tested by

no test coverage detected