5 Authoring Arbitrary Text Documents in the Notebook Editor

The jupytext package and associated server extension provides a toolkit for converting between the Jupyter notebook .ipynb document format and a wide variety of structured markdown formats including MyST and Rmd. Conversions with structure Python formats (such as the percent format used by VS Code, as well as other IDES) is also supported.

The jupytext server extension allows supported document formats to be opened directly from the notebook homepage into the notebook editor. Markdown and code cell input content are saved into the markdown formats, although such documents can also be “paired” with an .ipynb notebook document that will persist and render code cell outputs.

Native .ipynb documents can also be paired with one or more text form representations, so whenever the notebook is saved the additional formats, as well as the .ipynb format are saved too (for example, into a hidden directory).

Advantages of the simple text format include:

  • the saved content represents content that is directly manipulated by an author, rather than content generated as code outputs by executing code;
  • the text format and lack of output provides a simpler structure that makes diffing of content to compare multiple versions easier;
  • the lack of output means that secrets or data that may be rendered as part of code cell output are not leaked by mistake.