{ "cells": [ { "cell_type": "markdown", "metadata": { "nbsphinx": "hidden" }, "source": [ "This notebook is part of the `nbsphinx` documentation: https://nbsphinx.readthedocs.io/." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Using `toctree` In A Notebook\n", "\n", "In Sphinx-based documentation, there is typically a file called `index.rst` which contains one or more [toctree](https://www.sphinx-doc.org/en/master/usage/restructuredtext/directives.html#directive-toctree) directives.\n", "Those can be used to pull in further source files (which themselves can contain `toctree` directives).\n", "\n", "With `nbsphinx` it is possible to get a similar effect within a Jupyter notebook using the `\"nbsphinx-toctree\"` cell metadata.\n", "Markdown cells with `\"nbsphinx-toctree\"` metadata are not converted like \"normal\" Markdown cells.\n", "Instead, they are only scanned for links to other notebooks (or `*.rst` files and other Sphinx source files) and those links are added to a `toctree` directive.\n", "External links can also be used, but they will not be visible in the LaTeX output.\n", "\n", "If there is a section title in the cell, it is used as `toctree` caption (but it also works without a title).\n", "\n", "