Use the IO
context passed to Base.show to render DOM
#198
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hello!! 👋
This PR makes sure that the IOContext used to render the
App
(i.e. theio
passed toBase.show
), is also used to render the app's DOM (using thecontext
kwarg ofrepr
). I decided to store theIO
in theSession
, but feel free to change that.In Pluto, the IOContext is used to make special API available to display code like Hyperscript.jl. We use IOContext instead of a global variable because we found that this lets us make the API available only if we know it will work. It also allows us to differentiate between cells in a thread-safe way. In particular, the IOContext is used to support fonsp/Pluto.jl#2726
This PR is similar to JuliaPluto/HypertextLiteral.jl#27 and JuliaWeb/Hyperscript.jl#29 and MichaelHatherly/CommonMark.jl#58
This is only effective if JuliaWeb/Hyperscript.jl#43 is released, you currently need
Hyperscript#master
to use this.Example
To run this notebook, you need to have in your global environment: