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.
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:
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.
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
Edit:
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!