Generate a Table of Contents file from your book’s files

You can use jupyter-book to generate a table of contents file from your book using the filenames of your book’s content. To do so, run the following command

jupyter-book toc from-project path/to/book -f [jb-book/jb-article]

Jupyter Book will search mybookpath/ for any content files and create a _toc.yml file out of them. There are a few considerations to keep in mind:

  • Each sub-folder must have at least one content file inside it

  • The ordering of files in _toc.yml will depend on the alphanumeric order of the filenames (e.g., folder_01 comes before folder_02, and apage comes before b_page)

  • If there is a file called index.md in any folder, it will be listed first.

You may also generate navigation bar titles from each file of your book. If you do so, note that if the file name begins with <integer>_filename.md, then the <integer> part will be removed before it is inserted into _toc.yml.

In addition, you have a few extra options for controlling how the _toc.yml file is generated.

Usage: jupyter-book toc from-project [OPTIONS] SITE_DIR

  Create a ToC file from a project directory.

Options:
  -e, --extension TEXT            File extensions to consider as documents
                                  (use multiple times)  [default: .rst, .md]

  -i, --index TEXT                File name (without suffix) considered as the
                                  index file in a folder  [default: index]

  -s, --skip-match TEXT           File/Folder names which match will be
                                  ignored (use multiple times)  [default: .*]

  -t, --guess-titles              Guess titles of documents from path names
  -f, --file-format [default|jb-book|jb-article]
                                  The key-mappings to use.  [default: default]
  -h, --help                      Show this message and exit.