Skip to content

Example gallery notes

Kevin Anderson edited this page Dec 29, 2020 · 1 revision

The examples in the gallery on ReadTheDocs are generated from Jupyter notebooks using nbsphinx (one example page per notebook). To add a new notebook to the gallery, a few things need to happen:

  1. The example's thumbnail is automatically created from the images in the notebook. To choose which image is used, you need to edit the metadata of the notebook cell with the desired image to include a special tags value. You can do this either by opening the .ipynb file in a normal text editor or by editing cell metadata in a Jupyter notebook editor. The cell metadata should look like this:
    "metadata": {"tags": ["nbsphinx-thumbnail"]},
  1. Create a .nblink file in docs/sphinx/source/examples/ that points to the location of the new notebook. Be sure to save the .nblink file with the same name as the notebook. If the notebook is in the docs/ folder, the .nblink file will look like this:
    {
        "path": "../../../degradation_and_soiling_example_pvdaq_4.ipynb"
    }
  1. Finally, edit docs/sphinx/source/examples.rst and add the new notebook to the list under the .. nbgallery:: line.
Clone this wiki locally