Example Jupyter Notebook¶
MkDocs supports rendering Jupyter notebooks (.ipynb) as documentation pages using the mkdocs-jupyter plugin. This example notebook demonstrates how notebooks are rendered in this documentation.
Note: By default, notebooks are not executed during the MkDocs build — they are rendered as static HTML. This is because executing notebooks would require all of the notebook's dependencies to be installed in the build environment. Make sure your notebooks have saved cell outputs before adding them to the documentation.
If you need notebooks to be executed at build time, you can enable this by setting
execute: truein themkdocs-jupyterplugin configuration inmkdocs.yml, and ensuring all required dependencies are available in your build environment (e.g., inconda.yaml).
Learn More¶
Python Basics Example¶
Below is a simple Python code cell that computes a sum.
print("Hello from NCAR HPC Docs!")
print(f"2 + 2 = {2 + 2}")
Hello from NCAR HPC Docs! 2 + 2 = 4
Working with Data¶
A quick example using a list comprehension.
squares = [x**2 for x in range(1, 11)]
print(f"Squares: {squares}")
Squares: [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
Summary¶
This notebook confirms that .ipynb files render correctly in the MkDocs build.