Imagine both ideas as inspired by Jupyter Notebooks and their kernels.
Persistent kernel: e.g. each ```python``` code block is the same interpreter process with all the same variables. Same for bash, etc. The process is kept open and lines to exec piped to it. Or use a wrapper like Jupyter kernels (example [1]). Have the ability to run/re-run a specific code block.
Output capture: Yes if you echo something it could appear in an output block following the code block. Very much like a Jupyter Notebook cell showing it's output. The simplest output capture is just text, but you could also figure out how to hook into things like matplotlib and show plots (e.g. option to allow the output to be shown as a markdown sub-section).
Persistent kernel: e.g. each ```python``` code block is the same interpreter process with all the same variables. Same for bash, etc. The process is kept open and lines to exec piped to it. Or use a wrapper like Jupyter kernels (example [1]). Have the ability to run/re-run a specific code block.
Output capture: Yes if you echo something it could appear in an output block following the code block. Very much like a Jupyter Notebook cell showing it's output. The simplest output capture is just text, but you could also figure out how to hook into things like matplotlib and show plots (e.g. option to allow the output to be shown as a markdown sub-section).
[1] https://github.com/digitalsignalperson/comma-python