jbms / sphinx-immaterial

Adaptation of the popular mkdocs-material material design theme to the sphinx documentation system
https://jbms.github.io/sphinx-immaterial/
Other
203 stars 32 forks source link

[jupiter-book] Missing Table of Contents #331

Open Mrsenior12 opened 9 months ago

Mrsenior12 commented 9 months ago

I'm using this theme inside jupyter-book to generate documentation. Unfortunately in every file excluding "root" file Table of Contents is missing.

In documentation I could find anything related to that issue :(

Section with theme configuration in _config.yml looks like that:

sphinx:
  config:
    html_theme: "sphinx_immaterial"
    html_theme_options: {
    "globaltoc_collapse": True,
    "edit_uri": "blob/develop/docs",
    "features": [
      "navigation.expand",
      "navigation.selection",
      "navigation.top",
      "search.share",
      "toc.follow",
      "toc.sticky",
    ],
    "palette": [
        {
            "media": "(prefers-color-scheme: light)",
            "scheme": "default",
            "toggle": {
                "icon": "material/lightbulb-outline",
                "name": "Switch to dark mode",
            }
        },
        {
            "media": "(prefers-color-scheme: dark)",
            "scheme": "slate",
            "toggle": {
                "icon": "material/lightbulb",
                "name": "Switch to light mode",
            }
        },
    ],
  }
  extra_extensions:
  - sphinx_inline_tabs
  - sphinx_immaterial
2bndy5 commented 9 months ago

I never used jupiter-book before. Providing a config is not very helpful. Weirder that it is an oddly written YAML config. We need steps to reproduce. Can you attach a zip of a sample project that re-produces the problem?

2bndy5 commented 4 months ago

jupyter-book seems to support a lot of customizable options (including an optional third-party extension called sphinx-multitoc-numbering which is still in beta). In fact, jupyter-book is more like a wrapper around Sphinx (see their docs' explanation).

This theme's HTML templates were inherited from the mkdocs-material theme. So this theme deviates away from Sphinx' conventional ToC structure to work like a ToC generated by mkdocs (plus a build-time performance boost compared to sphinx-native ToC generation).

I'm not sure if we can support the jupyter-book project. Doing so might require involving devs from that project because there is so much going on under the hood. I would recommend using a theme by the executablebooks org as they are the github org also maintaining the jupyter-book project (among many other popular Sphinx extensions like MyST-parser).