Pluto "custom cell"

I would like to create in my notebook a custom cell, that looks and acts just like normal one, but the code within is parsed to an Expr tree that I can examine before Julia runs it. Can that be achieved using Pluto/PlutoUI API? Thanks.

Why not just write a macro and put @mymacro in front of the code in your cell?

I aim to make it harder for a user of the notebook to mess it up inadvertently. It shouldn’t be possible to remove macro call while editing the cell. Ideally, it shouldn’t be visible to a user.

BonitoBook let’s you extend the cell editor widget in Julia :wink:

It’s not fully documented yet, but there are a few examples in the intro notebook

1 Like

I would prefer to remain within Pluto ecosystem, because porting all existing work into the new notebook format would entail a great deal of work.

I think Pluto generally takes the “transparency” route: no hidden state, no hidden transformations. Even the markdown cells are just m"..." string macro calls. I don’t think Pluto allows plugging extra implicit transformation…
Although ping @fonsp.