@@ -4,6 +4,7 @@ using Artifacts: @artifact_str
44using Downloads: download
55using Random: randstring
66using Dates
7+ using REPL: REPLDisplay
78
89using JSON3: JSON3
910using EasyConfig: Config
@@ -13,15 +14,6 @@ using Cobweb: Cobweb, h, IFrame, Node
1314export Config, preset, Plot, plot
1415
1516# -----------------------------------------------------------------------------# __init__
16- function __init__ ()
17- # Hack since extensions with REPL are wonky
18- for M in Base. loaded_modules_order
19- if Symbol (M) == :REPL
20- @eval Base. display (:: $M.REPLDisplay , o:: Plot ) = Cobweb. preview (html_page (o))
21- end
22- end
23- end
24-
2517include (" json.jl" )
2618
2719artifact (x... ) = joinpath (artifact " plotly_artifacts" , x... )
133125rand_id () = " plotlyx-" * join (rand (' a' :' z' , 10 ))
134126
135127function html_div (o:: Plot , id= rand_id ())
136- h. div (class= " plotlylight-parent" , settings. src, settings . src_inject... , settings. div (; id), NewPlotScript (o, settings, id))
128+ h. div (class= " plotlylight-parent" , settings. src_inject... , settings . src , settings. div (; id), NewPlotScript (o, settings, id))
137129end
138130
139131function html_page (o:: Plot , id= rand_id ())
@@ -165,6 +157,9 @@ function Base.show(io::IO, ::MIME"text/html", o::Plot)
165157end
166158Base. show (io:: IO , :: MIME"juliavscode/html" , o) = show (io, MIME (" text/html" ), o)
167159
160+ Base. display (:: REPLDisplay , o:: Plot ) = Cobweb. preview (html_page (o), reuse= settings. reuse_preview)
161+
162+
168163# -----------------------------------------------------------------------------# preset
169164# `preset_template_<X>` overwrites `settings.layout.template`
170165# `preset_src_<X>` overwrites `settings.src`
0 commit comments