Stream: helpdesk (published)

Topic: Interpolate `Widget` into markdown


view this post on Zulip Mason Protter (Feb 15 2022 at 20:36):

If I do

using Interact
tb = textbox()
md"Title: $tb"

and then render and display that markdown on a webpage, I end up getting the textbox below the word "Title". Is there a way to interpolate the widget into Markdown in such a way that it doesn't make a new line?

view this post on Zulip Mason Protter (Feb 15 2022 at 20:38):

e.g.

julia> using Interact, Blink

julia> tb = textbox();

julia> body!(w, hbox(md"Title: $tb"));

results in
Screen-Shot-2022-02-15-at-1.37.56-PM.png

view this post on Zulip Mason Protter (Feb 15 2022 at 20:38):

I know I could write HTML, but I'm trying to figure out how far I can get just writing Markdown instead, since it's so much cleaner

view this post on Zulip Expanding Man (Feb 15 2022 at 20:39):

I was just going to say I'd try raw HTML. I think the markdown behavior in question is implementation-dependent, but in general markdown isn't really designed for this kind of specificity.

view this post on Zulip Mason Protter (Feb 15 2022 at 20:40):

Fair enough

view this post on Zulip Mason Protter (Feb 15 2022 at 20:41):

Pluto has spoiled me for a nice easy experience making and displaying widgets, but not having control over the reactivity and not having a REPL is driving me mad

view this post on Zulip Ian Weaver (Feb 15 2022 at 20:54):

Regarding your first point about widgets and manual reactivity in Pluto, would wrapping them in confirm work alright? My bad if you've already tried that!

view this post on Zulip Mason Protter (Feb 15 2022 at 21:07):

Hm, I actually didn't know about confirm, but I hacked my way around doing something similar. My problem isn't so much the widgets though, but everything else. The widgets are the part I want to be reactive.

The breaking point for me was when I made a little dashboard for data entry where the you input some data in various reactive textboxes, and then once you click a button, it push!s some computed data to a DataFrame. I had been very careful to do a bunch of tricks to make sure Pluto didn't destroy my dataframe while I was building it up, but then at the end of the process after I had spent like 20 minutes inputing data, I I wrote that data to disk, and then did one thing to check to make sure the data was right and a stray side effect caused Pluto to recompute the whole notebook, emptied my intermediate dataframe, and wrote the now empty dataframe to disk, overwriting the previous record I wrote

view this post on Zulip Mason Protter (Feb 15 2022 at 21:10):

Now, that example is really one that's just so fundamentally stateful that I shouldn't have expected anything other than disaster trying to do it in pluto, but even in other more tame cases I find myself fighting it so much that I think I'm just done with Pluto for now

view this post on Zulip Ian Weaver (Feb 15 2022 at 21:26):

Oh man, I've definitely been bitten by that before, sorry that happened to you! I usually get lucky and can just ctrl-z things from my text editor if using auto_reload_from_file, but I can definitely see how even that still wouldn't save you when doing things like text field input


Last updated: Oct 02 2023 at 04:34 UTC