Repository: executablebooks/jupyter-book
File: jupyter_book/config.py (Python)

Code before:
        if (
            "mathjax_path" in user_yaml_update
            and "@2" in user_yaml_update["mathjax_path"]
        ):
            # use mathjax2_config so not to tigger deprecation warning in future
            user_yaml_update["mathjax2_config"] = user_yaml_update.pop("mathjax_config")
        else:
            _message_box(
                (
                    f"[Warning] Mathjax configuration has changed for sphinx>=4.0 [Using sphinx: {sphinx.__version__}]\n"  # noqa: E501
                    "Your _config.yml needs to be updated:\n"  # noqa: E501
                    "mathjax_config -> mathjax3_config\n"  # noqa: E501
                    "To continue using `mathjax v2` you will need to use the `mathjax_path` configuration\n"  # noqa: E501
                    "\n"
                    "See Sphinx Documentation:\n"
                    "https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax"  # noqa: E501
                ),
                color="orange",
                print_func=print,
            )
            # Automatically make the configuration name substitution so older projects build
            user_yaml_update["mathjax3_config"] = user_yaml_update.pop("mathjax_config")

    # Recursively update sphinx config if option is specified,
    # otherwise forcefully override options non-recursively
    if sphinx_config.pop("recursive_update"):
        _recursive_update(sphinx_config, user_yaml_update)
    else:
        sphinx_config.update(user_yaml_update)

    # This is to deal with a special case, where the override needs to be applied after
    # the sphinx app is initialised (since the default is a function)
    # TODO I'm not sure if there is a better way to deal with this?
    config_meta = {
        "latex_doc_overrides": sphinx_config.pop("latex_doc_overrides"),
        "latex_individualpages": cli_config.pop("latex_individualpages"),
    }

    if sphinx_config.get("use_jupyterbook_latex"):
        sphinx_config["extensions"].append("sphinx_jupyterbook_latex")

    # finally merge in CLI configuration
    _recursive_update(sphinx_config, cli_config or {})

    # Add the `_static` folder to html_static_path, only if it exists
    if sourcedir and Path(sourcedir).joinpath("_static").is_dir():
        paths_static = sphinx_config.get("html_static_path", [])
        paths_static.append("_static")
        sphinx_config["html_static_path"] = paths_static

    if not use_external_toc:

Review comment (suggestion):
```suggestion
    if sphinx_config.pop("recursive_update") is True:
```

Code after:
        if (
            "mathjax_path" in user_yaml_update
            and "@2" in user_yaml_update["mathjax_path"]
        ):
            # use mathjax2_config so not to tigger deprecation warning in future
            user_yaml_update["mathjax2_config"] = user_yaml_update.pop("mathjax_config")
        else:
            _message_box(
                (
                    f"[Warning] Mathjax configuration has changed for sphinx>=4.0 [Using sphinx: {sphinx.__version__}]\n"  # noqa: E501
                    "Your _config.yml needs to be updated:\n"  # noqa: E501
                    "mathjax_config -> mathjax3_config\n"  # noqa: E501
                    "To continue using `mathjax v2` you will need to use the `mathjax_path` configuration\n"  # noqa: E501
                    "\n"
                    "See Sphinx Documentation:\n"
                    "https://www.sphinx-doc.org/en/master/usage/extensions/math.html#module-sphinx.ext.mathjax"  # noqa: E501
                ),
                color="orange",
                print_func=print,
            )
            # Automatically make the configuration name substitution so older projects build
            user_yaml_update["mathjax3_config"] = user_yaml_update.pop("mathjax_config")

    # Recursively update sphinx config if option is specified,
    # otherwise forcefully override options non-recursively
    if sphinx_config.pop("recursive_update") is True:
        _recursive_update(sphinx_config, user_yaml_update)
    else:
        sphinx_config.update(user_yaml_update)

    # This is to deal with a special case, where the override needs to be applied after
    # the sphinx app is initialised (since the default is a function)
    # TODO I'm not sure if there is a better way to deal with this?
    config_meta = {
        "latex_doc_overrides": sphinx_config.pop("latex_doc_overrides"),
        "latex_individualpages": cli_config.pop("latex_individualpages"),
    }

    if sphinx_config.get("use_jupyterbook_latex"):
        sphinx_config["extensions"].append("sphinx_jupyterbook_latex")

    # finally merge in CLI configuration
    _recursive_update(sphinx_config, cli_config or {})

    # Add the `_static` folder to html_static_path, only if it exists
    if sourcedir and Path(sourcedir).joinpath("_static").is_dir():
        paths_static = sphinx_config.get("html_static_path", [])
        paths_static.append("_static")
        sphinx_config["html_static_path"] = paths_static

    if not use_external_toc: