Insert and update content from a Jupyter notebook

Extension name

The Docs Authoring Pack, Visual Studio Code meta extension is comprised of multiple sub extensions. This feature is included in the Docs Markdown extension. The Docs Markdown extension is part of the Docs Authoring Pack, there is no need to install it separately.

Important

Insert and update from a Jupyter notebook functionality does not currently work on a Mac.

Summary

Jupyter Notebooks are a standard interactive way of creating and sharing code in the Python world. The notebook contains a combination of Python code, markdown, and optionally output from the code.

The Docs Authoring Pack extension includes functionality to put a static markdown version of a Jupyter notebook into your document:

Docs: Insert Jupyter notebook: Enter the URL of the notebook. A markdown version of the notebook is added to the document at the position of your cursor. Do not modify the start or end tags; it's what the next function uses to update the notebook.

Docs: Update Jupyter notebook: This function will replace the previously inserted notebook content between start and end with the latest version. No need to enter the URL, it's recorded in the start tag. Update functionality assumes there is a single notebook in the document. Don't add multiple notebooks to a single document.

In action

Below is a brief demonstration of this feature.

Insert Jupyter notebook

Troubleshooting

Important

Insert and update from a Jupyter notebook functionality does not currently work on a Mac.

These functions need Python, jupyter, and nbconvert installed on your machine.

To see if Python is installed, open a VS Code terminal and run:

  • Windows - where python
  • Linux/Mac - which python

If the return is one or more paths, Python is installed. If not, install Python now.

Next make sure jupyter is installed:

  • Windows - where jupyter
  • Linux/Mac - which jupyter

If a path is not returned, install jupyter:

pip install --upgrade jupyter

Once both Python and jupyter are installed, install nbconvert:

pip install --upgrade nbconvert