When writing answers for Stack Overflow it is a good idea to test your code before publishing it. In some cases to replicate the questioner's problem I have to install extra packages.
I find it very useful for cases like this to use Google Colab to quickly install the packages I need, write code, test it, and finally write an answer, all without having to install anything locally on my computer. I then manually copy and paste the Colab code into SO, but that can introduce errors or inconsistencies.
Ideally, you would be able to develop a full, tested response in Colab and then automatically somehow "export" what was written there for inclusion in an SO response.
As far as I know in Jupyter Notebook there is a command to export to markdown, is there an automatic way to achieve the same in Google Colab, considering that there is no access to the file .ipynb
?