TP-reinforcement-learning/export_html.jl

39 lines
970 B
Julia
Raw Normal View History

2024-01-02 10:44:10 +00:00
using Pluto
function export_html(notebook_path, html_path)
# load notebook
notebook = Pluto.load_notebook(Pluto.tamepath(notebook_path));
topology = Pluto.updated_topology(notebook.topology, notebook, notebook.cells)
# create offline workspace
workspace = Pluto.WorkspaceManager.make_workspace(
(
Pluto.ServerSession(),
notebook,
),
is_offline_renderer=true,
)
# run all the cells of the notebook
for cell in notebook.cells
Pluto.run_single!(
workspace,
cell,
topology.nodes[cell],
topology.codes[cell],
)
end
# convert notebook outputs to html
html_contents = Pluto.generate_html(notebook);
# write to html file
open(html_path, "w") do html_file
write(html_file, html_contents);
end
end
# TODO: use loop cli args
export_html("exos.jl", "exos.html")
export_html("index.jl", "index.html")