Automatically convert a Pluto Cell to markdown


I am thinking of using Pluto as a sort of Electronic Lab Notebook from where I could drive an experiment and do analysis on the fly. To avoid running a command (e.g. measuring the transmission of a device with a VNA) several times, I was thinking of turning a cell into markdown after it has been executed. Ideally, I would like to add a timestamp and place the command in between backticks so that it’s nicely formatted. Is there a way to do that automatically, for instance using a macro? If not, is there a way to define keyboard shortcuts?

Any suggestion to make this cell conversion to markdown would be appreciated.

You may want to consider produce_or_load from DrWatson.jl, which would save the results of each command to an external file for later analysis.

Thanks for your input but I don’t think it fits what I’m looking for. I’d like to be able to mix instrument driving/data taking and analysis. To clarify, I made a mock-up of what I have in mind: suppose I have a command measure_transmission that drives an instrument and there’s a ‘magic’ macro that does the cell conversion I’m thinking of. Before running the cell, it would look like that:

and after running the cell, it would look like this:

I hope this clarifies what I have in mind…

After my little playing with Pluto, I’m not sure what you seek is possible and if I’m allowed to speculate I believe it goes against the very intentions of the tool.

I believe you’d have more luck trying to get Jupyter notebooks to do something like this.

Not sure why this would be against the intentions of the tool. All I want is a quick and easy way to turn a cell into markdown (easy with a ctrl+m) but in addition I’d like to have the code surrounded by backticks so that it is displayed as a code block in markdown.

I’d like to keep using Pluto because I actually really like the reactivity for the analysis part and I also like that it directly adds packages that are not installed yet.

I don’t think it’s completely out of scope - Fons started a discussion on experimental control this spring:

There’s some discussion of converting cells to Markdown here:

Thanks for the links, this is exactly what I had in mind. The issues mentioned in that thread (e.g. unintentional reactivity) are the reasons why I was thinking of turning the cells into markdown: I would keep track of past commands without running the risk of having these commands re-run if I restart the notebook.

Should be doable by making a macro return a block where the first expression execute the Julia code and the second expression (the one that is sent to the Pluto output) returns an Html with Javascript inside a script tag that modifies the cell to markdown and then rerun it…

Not at the computer to try it now though

I did have a chance to try this and indeed it is possible:

And here is the link to the notebook code for testing:

Note that this is somehow a hacky solution which might not work anymore when Pluto changes to CM6 (don’t know how long it’ll take), or in general with new versions of Pluto.

But overall it still highlight the amazing capabilities of Pluto!


That looks awesome! I’m going to try it in lab as soon as I have a chance. Thanks!