-
-
Notifications
You must be signed in to change notification settings - Fork 359
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
embeddable html show for performance in Pluto #3559
embeddable html show for performance in Pluto #3559
Conversation
CI failure seems unrelated |
Codecov Report
@@ Coverage Diff @@
## master #3559 +/- ##
==========================================
- Coverage 64.50% 64.48% -0.02%
==========================================
Files 27 27
Lines 6623 6623
==========================================
- Hits 4272 4271 -1
- Misses 2351 2352 +1
Continue to review full report at Codecov.
|
Looks good to me |
@isentropic @BeastyBlacksmith I could do further Pluto-plotly optimizations, including:
Some discussion here: https://discourse.julialang.org/t/pluto-plots-with-plotlybase-plotlyjs-with-working-static-html-export/61730/7 Demo notebooks:
Implementing this would mean using some code ( |
That'd definitely welcome. |
Standalone/embeddable html in
Base.show
Currently, the
Base.show(io::IO, m::MIME"text/html", p::Plot{PlotlyBackend})
method outputs a standalone HTML document, i.e.which means that it cannot (correctly) be embedded inside HTML output, without using an
<iframe>
.This is why
text/html
show methods in Julia are generally not standalone pages, but HTML snippets. A good example is Plots.jl with the GR backend, whereBase.show(io::IO, m::MIME"text/html", p::Plot{PlotlyBackend})
outputs a bare<img>
or<svg>
tag, not wrapped inside<html>
.Other examples are DataFrames.jl (bare
<table>
) and the Markdown stdlib (bare<div>
).<script>
tags do not need to be placed inside a<head>
to load, which is why this PR replaces the show method with a simpler one.Before
Because every cell output is a standalone HTML document, Pluto needs to create a new
iframe
to render the subpage in, causing notable flickering.Schermopname.2021-06-08.om.20.22.03.mov
After
Schermopname.2021-06-08.om.20.25.13.mov
Other environments still work
VS Code
Jupyter
Static
Environments that generate static HTML will be unaffected, including Franklin and Literate.
Example code
(For Pluto and Jupyter)