Skip to content

Instantly share code, notes, and snippets.

@j-fu
Created September 29, 2023 15:17
Show Gist options
  • Save j-fu/48f820df9723efb993b491b112fb470b to your computer and use it in GitHub Desktop.
Save j-fu/48f820df9723efb993b491b112fb470b to your computer and use it in GitHub Desktop.
htl_mwe2.jl
### A Pluto.jl notebook ###
# v0.19.29
using Markdown
using InteractiveUtils
# ╔═╡ e052cc91-ca85-492d-95e2-6b0c707ac859
begin
using Pkg
Pkg.activate(mktempdir())
Pkg.add(url="https://github.com/JuliaPluto/HypertextLiteral.jl/#36")
Pkg.add("AbstractPlutoDingetjes")
import HypertextLiteral: @htl
import AbstractPlutoDingetjes.Display: published_to_js
using AbstractPlutoDingetjes
end
# ╔═╡ ae4677c4-5d18-11ee-002c-934296bff110
let
x = Dict(
"data" => rand(Float64, 20),
"name" => "juliette",
)
@htl("""
<script>
// we interpolate into JavaScript:
const x = $(published_to_js(x))
alert(x.name)
</script>
""")
end
# ╔═╡ Cell order:
# ╠═e052cc91-ca85-492d-95e2-6b0c707ac859
# ╠═ae4677c4-5d18-11ee-002c-934296bff110
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment