microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.27k stars 280 forks source link

Export as markdown option for .ipynb files (Jupyter notebooks) #1376

Open aeturrell opened 3 years ago

aeturrell commented 3 years ago

When working directly with .ipynb files in VS Code, the current GUI export options are python script, HTML, and PDF.

It would be great if the VS Code Python extension had an export as markdown option too. Currently, users who want markdown have to re-open the .ipynb file in Jupyter notebook and use its export as markdown option, or use the command line converter.

Given the other export options are already implemented, my guess is that this would be relatively easy to implement too.

joyceerhl commented 3 years ago

Thanks for the feature request! We would use nbconvert to add this functionality, and we will discuss the prioritization of this feature at our weekly triage meeting. 😊

rchiodo commented 3 years ago

We should just add all formats.

aeturrell commented 3 years ago

That would be fantastic.

For context, in case it's interesting or useful to know, the main use case behind my issue is blogging. Jupyter has been, in my experience, the best option for exporting to markdown with good formatting and integrated figures suitable for blogging via eg Jekyll. I've also tried Rmarkdown, which didn't format code blocks very well, and codebraid, which is brilliant but lacks the automated figure export (for now).

hedbergec commented 2 years ago

Or, for those of us who write papers and collaborate with others who don't use jupyter, exporting to MS Word would rule. Perhaps markdown > pandoc > word?

matchavez commented 2 years ago

What's silly is you can literally open-for-edit every cell, copy all, and paste into a new .md, and you only need to go through and separate the cells.

Not a great workaround… can someone let the new intern work on this?

code cells surrounded by three ` all cells separated by crlf --- crlf.

rchiodo commented 2 years ago

The root issue here is getting nbconvert to work. We've moved away from it for convert to python. Convert to html usually works. Convert to pdf almost never works. So adding more nbconvert options would be iffy.

matchavez commented 2 years ago

Well markdown would seem to be foolproof, given it just does 4 spaces on code blocks. Would be cool to implement, and seems like it wouldn't be any more than adding the variable to the select list. ¯_(ツ)_/¯

If it's already fairly broken, not much risk. :)

$ jupyter nbconvert --to markdown notebook.ipynb

ruslaniv commented 1 year ago

Are there any updates on this?

There is a great plugin for JupyterLab - JupyText that works great with the Lab to convert notebooks to MD, could anything similar be done with VS Code?

kathekon commented 1 year ago

would also love to see this

etienneschalk commented 6 months ago

It would be so powerful to help reporting issues in libraries for instance.

Even better: imagine an integration with GitHub: you write a notebook and can derive an issue from it, that is already well written and with repeatable code examples!

Barmaid1076 commented 2 months ago

What's silly is you can literally open-for-edit every cell, copy all, and paste into a new .md, and you only need to go through and separate the cells.

Not a great workaround… can someone let the new intern work on this?

code cells surrounded by three ` all cells separated by crlf --- crlf.

code cells surrounded by three ` all cells separated by crlf --- crlf. could be set as an option, and the python code could be embedded in the format below

code

with "python" after the 3 `