Interactive notepad in Livebook

I noted in my roadmap for ex_cldr that I’m interesting in building an interactive notebook like numpad or calca since I have pretty much all the “knowledge” pieces already built. And Livebook is 99% of the way to present it.

What I don’t know is if there is a way to “hijack” the REPL in Livebook so that instead of the input expressions going to iex they go to a different evaluator (ie my code).

Basically, I would like a way for the “code block” to be evaluated by my code, not by Elixir directly. I don’t feel I’m expressing myself well today - take a look at numpad and you’ll know what I mean :slight_smile:

Thoughts on how to approach the UI part of this very welcome!


Smart cells in livebook have control over the edited text. E.g. kino db allows for editing sql in the cell, which behind the scenes is quieries against a db using drivers like postgrex.


Yes, you have two options here:

  1. A smart cell which already has editor support. However, a smart cell has limited controls around the editor and a smart cell must emit Elixir code that will be evaluated at the end

  2. A general Kino.JS or Kino.JS.Live so you could do in an Elixir cell and it renders the Numpad. But in this case, you would have to build the whole editor from scratch (maybe using Monaco or using something else)