skip to Main Content

How to convert ipynb file into txt or a markdown file where the JSON of the notebook file is wrapped in a code block?

I have a file ipynb which i want to convert into markdown or plain txt file. I create the file using vscode IDE. I don’t see export to txt or md option. I have jupyter extension installed in vscode.

3

Answers


  1. Open your ipynb file with Text Editor in Linux or with Notepad in Windows.
    Then you will see a json like file. You can save it as txt file.

    Login or Signup to reply.
  2. You can view the textual JSON contents of Jupyter Notebooks in VS Code by using the View: Reopen Editor With Text Editor command in the command palette. If you want to create a markdown file containing that JSON wrapped in a code block, the just select all the JSON contents from the text view, then create a markdown file with a code block, and paste the contents of the file into that code block.

    Login or Signup to reply.
  3. In terminal, go to the directory with the notebook, and run

    python -m notebook
    

    It will open a page in a browser. Open your notebook. Under File in the top left, you can export your notebook into various formats.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search