Skip to content
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

Add publish_to_js #5

Closed
fonsp opened this issue Feb 23, 2022 · 2 comments · Fixed by #11
Closed

Add publish_to_js #5

fonsp opened this issue Feb 23, 2022 · 2 comments · Fixed by #11

Comments

@fonsp
Copy link
Member

fonsp commented Feb 23, 2022

@fonsp fonsp linked a pull request Jun 7, 2022 that will close this issue
2 tasks
@fonsp fonsp linked a pull request Sep 28, 2022 that will close this issue
7 tasks
@fonsp fonsp removed a link to a pull request Sep 28, 2022
2 tasks
@j-fu
Copy link
Contributor

j-fu commented Sep 26, 2023

Hi, trying to replace the old publish_to_js with the new one from this package in PlutoVista.jl. I get the following error:

AssertionError: `AbstractPlutoDingetjes.Display.published_to_js` is not supported by this `IO` display.

If you are not using `published_to_js` (or you do not know what it is), or you are not using Pluto, then please report this error to the package that you are using.

If you are trying to use `published_to_js` but it is not working, please make sure that:

- Pluto is up to date.

- The original IO context is used to render the widget.

- If you want to support non-Pluto environments, you use `AbstractPlutoDingetjes.is_supported_by_display` for a fallback.

See the documentation for `published_to_js` to learn more about these points.

    show(::IOBuffer, ::MIME{Symbol("text/javascript")}, ::AbstractPlutoDingetjes.Display._PublishToJS)@AbstractPlutoDingetjes.jl:257
    show(::IOBuffer, ::AbstractPlutoDingetjes.Display._PublishToJS)@AbstractPlutoDingetjes.jl:273
    print(::IOBuffer, ::AbstractPlutoDingetjes.Display._PublishToJS)@io.jl:35
    print_to_string(::String, ::Vararg{Any})@io.jl:144
    [email protected]:185[inlined]
    show(::IOContext{IOBuffer}, ::MIME{Symbol("text/html")}, ::PlutoVista.PlutoPlotlyPlot)@plutoplotlyplot.jl:63
    show_richest(::IOContext{IOBuffer}, ::Any)@PlutoRunner.jl:1376
    [email protected]:1290[inlined]
    format_output_default(::Any, ::Any)@PlutoRunner.jl:1012
    #format_output#[email protected]:1029[inlined]
    [email protected]:1029[inlined]
    #[email protected]:914[inlined]
    var"#with_io_to_logs#126"(::Bool, ::Base.CoreLogging.LogLevel, ::typeof(Main.PlutoRunner.with_io_to_logs), ::Main.PlutoRunner.var"#53#56"{Base.UUID, Base.UUID, Module, PlutoVista.PlutoPlotlyPlot, Dict{Tuple{UInt64, Int64}, Int64}})@PlutoRunner.jl:2661
    [email protected]:2608[inlined]
    (::Main.PlutoRunner.var"#130#131"{Bool, Base.CoreLogging.LogLevel, Main.PlutoRunner.var"#53#56"{Base.UUID, Base.UUID, Module, PlutoVista.PlutoPlotlyPlot, Dict{Tuple{UInt64, Int64}, Int64}}})()@PlutoRunner.jl:2685
    with_logstate(::Function, ::Any)@logging.jl:514
    [email protected]:626[inlined]
    #with_logger_and_io_to_logs#[email protected]:2684[inlined]
    [email protected]:2683[inlined]
    var"#formatted_result_of#50"(::Bool, ::typeof(Main.PlutoRunner.formatted_result_of), ::Base.UUID, ::Base.UUID, ::Bool, ::Vector{String}, ::Nothing, ::Module)@PlutoRunner.jl:913
    top-level [email protected]:482

@j-fu
Copy link
Contributor

j-fu commented Sep 26, 2023

Ok, got it - RTFM more about HypertextLiteral!

Pass everything as @htl strings, wrap javascript code to be interpolated and read from the assets directory as const JavaScript(read("mycode.js",String)). Seems to work now.

See j-fu/PlutoVista.jl#12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants